# How to enable 307 Temporary Redirect

**URL:** <https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841>\
**Category:** General\
**Created:** [28 December 2022 16:31 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841 "2022-12-28T16:31:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![GabrielGS](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@GabrielGS](https://discourse.nodered.org/u/GabrielGS)\
**Post date:** [28 December 2022 16:31 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/1 "2022-12-28T16:31:28Z")

</div>

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

* * *
nginx/1.18.0

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...

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [28 December 2022 17:14 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/2 "2022-12-28T17:14:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GabrielGS](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@GabrielGS](https://discourse.nodered.org/u/GabrielGS)\
**Post date:** [28 December 2022 18:28 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/3 "2022-12-28T18:28:51Z")

</div>

> [@marcus-j-davies](#):
>
> 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

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

This is the content I'm using in node:

```auto
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:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/5/b/5b9aa27740ffb1d0fd17f8453e5a62f6cf1ea678.png)

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

```auto
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);
  console.log(response.body);
});

```

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [28 December 2022 19:10 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/4 "2022-12-28T19:10:32Z")

</div>

> [@GabrielGS](#):
>
> this is the content i'm using in Postman (node.js - Request):

Sorry - not sure I follow.  
I use [https://www.postman.com](https://www.postman.com) 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? 😅

---

<div class="post-metadata">

**Author:** ![GabrielGS](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@GabrielGS](https://discourse.nodered.org/u/GabrielGS)\
**Post date:** [28 December 2022 19:36 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/5 "2022-12-28T19:36:38Z")

</div>

Sorry i copied the code fragment, i think i got it wrong 😅

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/3/b38defce610196ef2d3b0e65c5cd459ed675a934.png)

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

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [28 December 2022 19:42 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/6 "2022-12-28T19:42:15Z")

</div>

Yes, you sent the code example that Postman generates for Node JS 🤣  
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?

---

<div class="post-metadata">

**Author:** ![GabrielGS](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@GabrielGS](https://discourse.nodered.org/u/GabrielGS)\
**Post date:** [28 December 2022 20:10 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/7 "2022-12-28T20:10:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 December 2022 20:11 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/8 "2022-12-28T20:11:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![GabrielGS](https://avatars.discourse-cdn.com/v4/letter/g/c37758/32.png) [@GabrielGS](https://discourse.nodered.org/u/GabrielGS)\
**Post date:** [28 December 2022 20:25 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/9 "2022-12-28T20:25:11Z")

</div>

Of course, here is the payload error

```auto
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>↵"

```

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [28 December 2022 20:35 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/10 "2022-12-28T20:35:42Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 February 2023 20:36 UTC](https://discourse.nodered.org/t/how-to-enable-307-temporary-redirect/72841/11 "2023-02-26T20:36:21Z")

</div>

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