How to enable 307 Temporary Redirect

I'm trying to perform an authentication request in an API using the POST method, but I'm getting the following error:

307 Temporary Redirect

307 Temporary Redirect


When I use Postman the problem does not happen.
Is it possible to solve this problem in the function or http request?

Sorry if it's something simple, I'm still learning...

Hi @GabrielGS Welcome to the Forums.

You can help us help you, by given us more context to work with.

Can you paste the full content of what it is you're posting in Node RED (including any headers) - maybe paste the flow so we can see it all? and the equivalent in postman will help.

Redact any sensitive credential data of course

1 Like

Hi @marcus-j-davies, thank you so much for helping me.

This is the content I'm using in node:

msg.url = msg.auth.url

msg.headers ={
  'Content-Type': 'application/x-www-form-urlencoded'

msg.payload ={
'password': msg.auth.password,
'username': msg.auth.username,
'grant_type': msg.auth.grant_type,
'client_secret': msg.auth.client_secret,
'client_id': msg.auth.client_id,

return msg;

Http request:

this is the content i'm using in Postman (node.js - Request):

var request = require('request');
var options = {
  'method': 'POST',
  'url': '{{oauth_url}}',
  'headers': {
    'Content-Type': 'application/x-www-form-urlencoded'
  form: {
    'password': '{{oauth_password}}',
    'username': '{{oauth_username}}',
    'grant_type': '{{oauth_grant_type}}',
    'client_secret': '{{oauth_client_secret}}',
    'client_id': '{{oauth_client_id}}'
request(options, function (error, response) {
  if (error) throw new Error(error);

Sorry - not sure I follow.
I use to test web services,
but Im reading this as a node script that is doing a request not postman its self?

Im trying to find out if this request module you are using is following redirects silently?

Unless I didn't know Postman can use NodeJS as its agent? :sweat_smile:

Sorry i copied the code fragment, i think i got it wrong :sweat_smile:

If I send you the request and the response header would it help?

Yes, you sent the code example that Postman generates for Node JS :rofl:
but when executing postman - its using its own engine - that may be following redirects

can you try adding
msg.followRedirects = true
before hitting the request node?

to see if it make a difference?

1 Like

Yes, I already tried to use the msg.followRedirects = true but I was not successful...

That is the default anyway. Can you show the actual error you get in Node-RED please?

Of course, here is the payload error

payload: "<html>↵<head><title>307 Temporary Redirect</title></head>↵<body>↵<center><h1>307 Temporary Redirect</h1></center>↵<hr><center>nginx/1.18.0</center>↵</body>↵</html>↵"

OK, but that isn't an error, just a notification that a temporary redirect has happened. Temporary and Permanent redirects are relatively common in the HTTP world. When you use Postman, it is automatically following the redirect but it would seem that the request node is not. Possibly a bug. Will need reporting on GitHub I think.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.