# Http request Node not working in NodeRED behind Reverse Proxy

**URL:** <https://discourse.nodered.org/t/http-request-node-not-working-in-nodered-behind-reverse-proxy/63043>\
**Category:** General\
**Tags:** http-request, docker\
**Created:** [25 May 2022 10:53 UTC](https://discourse.nodered.org/t/http-request-node-not-working-in-nodered-behind-reverse-proxy/63043 "2022-05-25T10:53:41Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bond246](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bond246/32/16460_2.png) [@Bond246](https://discourse.nodered.org/u/Bond246)\
**Post date:** [25 May 2022 10:53 UTC](https://discourse.nodered.org/t/http-request-node-not-working-in-nodered-behind-reverse-proxy/63043/1 "2022-05-25T10:53:41Z")

</div>

Hello,

i have multible instances of NodeRED in a docker environment. To access them i exposed different Ports for every instance via settings.js and set up a nginx reverse proxy via docker and used virtualports.

So now i can access all NodeRED-instances via different sub-domains with ssl-letsencrypt and regulary with http/443. The reverse proxy passes the sub-domains to different ports: 1881, 1882, 1883...

Everything is fine except one thing:  
If i use a http request node to GET any resources from outside in the world i just geht:

```auto
RequestError: Bad response: 400

```

When i use the exec-node with curl it works.

What else is to be done to get the http-request-nodes to work?

Thanks  
Bond

---

<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:** [25 May 2022 11:07 UTC](https://discourse.nodered.org/t/http-request-node-not-working-in-nodered-behind-reverse-proxy/63043/2 "2022-05-25T11:07:48Z")

</div>

Not sure what is happening but you sometimes get issues with and without trailing slashes that can result in failed requests. Might be worth checking. Is it NGINX that is returning the 400 or is it Node-RED responding to the proxy?

You might need to turn up the logging level in NGINX - it logs 400 errors at "info" level, that may give you more information.

400 errors can happen for all sorts of issues though errors in headers are common so you might also want to check whether you are setting any invalid headers in your http-out.

---

<div class="post-metadata">

**Author:** ![Bond246](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bond246/32/16460_2.png) [@Bond246](https://discourse.nodered.org/u/Bond246)\
**Post date:** [25 May 2022 11:53 UTC](https://discourse.nodered.org/t/http-request-node-not-working-in-nodered-behind-reverse-proxy/63043/3 "2022-05-25T11:53:33Z")

</div>

Thanks for your answer,

ok lets get more detailed. Thats the test-flow i use:

```auto
[{"id":"a19ef90eaf27df1c","type":"inject","z":"77b37ced868e9673","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":220,"y":640,"wires":[["3df9b0aa9707ec0d"]]},{"id":"3df9b0aa9707ec0d","type":"http request","z":"77b37ced868e9673","name":"","method":"GET","ret":"obj","paytoqs":"ignore","url":"https://wttr.in/Berlin?format=j1","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":430,"y":700,"wires":[["c210afae3e1cb425"]]},{"id":"c210afae3e1cb425","type":"debug","z":"77b37ced868e9673","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":650,"y":640,"wires":[]}]

```

The container is running on ubuntu 20.04 with latest docker-version. The NodeRED-Container uses version 2.2.2-16 so with nodejs-16. I had to move from nodejs-14 to 16 to use a specific nodered-package but even with the standard container and nodejs-14 i get this problem.

In addition i configured settings.js with log-level "trace" which unfortunately brings not more information:  
`25 May 13:37:50 - [error] [http request:3df9b0aa9707ec0d] RequestError: Bad response: 400`

And also logging in the reverse proxy is not very useful:

```auto
nginx.1 | https://domain/ xx.xx.xx.xx - - [25/May/2022:13:37:50 +0200] "POST /inject/a19ef90eaf27df1c HTTP/2.0" 200 2 "https://domain/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:100.0) Gecko/20100101 Firefox/100.0" "172.18.0.2:1881"
nginx.1 | _ 172.18.0.1 - - [25/May/2022:13:37:50 +0200] "CONNECT wttr.in:443 HTTP/1.1" 400 150 "-" "-" "-"

```

What also is done in docker-config for that container i set a ENV "http\_proxy" to my subdomain.

Where can i see which header is configured by default for the http request node?

---

<div class="post-metadata">

**Author:** ![Bond246](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bond246/32/16460_2.png) [@Bond246](https://discourse.nodered.org/u/Bond246)\
**Post date:** [25 May 2022 12:36 UTC](https://discourse.nodered.org/t/http-request-node-not-working-in-nodered-behind-reverse-proxy/63043/4 "2022-05-25T12:36:54Z")

</div>

i found the solution.  
Don't know why but i set the "http\_proxy"-setting as described above.  
But of couse the NodeRED-instance does not have to use a proxy. So i disabled that again and now everything is fine.

---

<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:** [8 June 2022 12:37 UTC](https://discourse.nodered.org/t/http-request-node-not-working-in-nodered-behind-reverse-proxy/63043/5 "2022-06-08T12:37:04Z")

</div>

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