The Node-RED I am working on is installed on top of an Ubuntu container.
(I didn't create this container nor can I modify it.)
I want to create a flow with a simple HTTP get request to another container on the same docker network but I keep on getting a 403 forbidden error.
[{"id":"332622ed.d87fbe","type":"http request","z":"8431aef4.eba67","name":"","method":"GET","ret":"txt","url":"http://172.16.0.5:8080/path/to/something","tls":"","x":890,"y":700,"wires":[["f49e6445.15d988"]]},{"id":"277f03cb.536f8c","type":"inject","z":"8431aef4.eba67","name":"","topic":"","payload":"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":730,"y":700,"wires":[["332622ed.d87fbe"]]},{"id":"f49e6445.15d988","type":"debug","z":"8431aef4.eba67","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":1050,"y":700,"wires":[]}]
So I tried doing the request from within the docker container itself
i.e. through:
docker exec -it ubuntu_nodered bash
curl –X GET "http://172.16.0.5:8080/path/to/something"
The 403 forbidden error persists. Later, I found out the container has a proxy setting so I tried:
curl –X GET --noproxy "*" "http://172.16.0.5:8080/path/to/something"
Alas, I got a proper response from this command.
Now that I'm sure the issue is with the proxy... How do I make the HTTP requests from the flow NOT TO USE the proxy settings from the environment it is in for requests on 172.16.0.x?
You need to set the NO_PROXY
environment variable. The doc for the variable can be found here.
This should hold a comma separated list of hosts/ip addresses that should not be used with the proxy. Looking at this question/answer it looks like you can not easily add ranges of IP addresses so you will need to add all the addresses in the range you want not to proxy.