Using NGINX on a dev machine w/ a system proxy

mrjoshua asked:

NGINX doesn’t seem to recognize my HTTP_PROXY setting in bash profile, is there something I need to do here? Running on OSX Lion.

Just to clarify, I’m setting a reverse proxy that will host static files and route requests to our app qa server which is outside of our network. I just need to know how to get nginx to obey proxy settings.

My answer:


You can’t do that.

nginx was designed and intended to reverse proxy to upstream app servers on the same machine or nearby on the local network. It assumes that it has a direct connection available to the upstream servers.

While you can reverse proxy to another machine across the Internet, and this is occasionally useful in migration scenarios, it was never intended to be a “client” that would have to obey proxy server settings. Thus nginx has no functionality to route upstream requests through yet another proxy server.

Some things you can do include:

  • Install nginx on the actual development server where your existing development app server is.
  • Install a copy of the development app server on your local machine, where nginx can proxy to it.
  • Ask your network administrator to poke a hole in the firewall to allow the egress traffic from your workstation to the external app server.

(P.S. I expect you were downvoted because the original question wasn’t clear enough to answer; you should expect some of those to go away as the people who downvoted notice the clarified question.)


View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.