0

I am building a nodejs+express application which makes a HTTP GET call using the node-fetch library to retrieve a response from a service. The problem is the host of that service which I am calling does not work well with proxy, it sometime returns a response and sometimes it fails, which is working as designed. So I was asked to add the hostname of that API call to the NO_PROXY environment variable to get it to work. I am running the application in a docker container so I have added it as an ENV variable as well as added it on the node app startup script as

NODE_ENV=xyz.abc.com node app.js

However I am still running into the same issue and looks like the node+express application is not considering the NO_PROXY variable is using the proxy to make the REST call. Is there any other way to configure it so that the the environment variable is picked up.

zakSyed
  • 1,364
  • 1
  • 13
  • 30
  • could you check your env variables by logging it please? `console.log(process.env)` or `console.log(process.env.NO_PROXY)` – Quentin C Oct 28 '20 at 21:58
  • @QuentinC I see it being set – zakSyed Oct 28 '20 at 22:56
  • when starting your docker container maybe try: dockerfile: ```ENV NO_PROXY="*.test.example.com,.example2.com"``` or for dockerrun `--env NO_PROXY="*.test.example.com,.example2.com"` but maybe you already did that from what I see – Quentin C Oct 28 '20 at 23:10

0 Answers0