[IE] Can Nginx used as a reverse proxy send HTTP(s) requests through a forward proxy ?

Jason Whittington Jason.Whittington at equifax.com
Thu Dec 7 18:02:44 UTC 2017


Are you trying to do  something like this?

server foo {
   listen 443 ssl;

  ...other settings elided...

   location /foo/ {
      https://external_site/;
   }
}

If https://external_site/ traverses a proxy then the answer is “no” – nginx can’t deal with proxy situations where it has to issue HTTP CONNECT.  I don’t know much about squid but I expect you’ll have the same problem.  You’ll see that requests will just …fail.

I got around it by creating a little node.js app to fetch the external resource from external_site and pointed nginx at the node app.  Feels like a bit of a hack but it works well enough.  Incidentally I found pm2 to be a really nice container to turn 50 lines of js into a decent service that runs as a non-privileged user, starts on boot, restarts automatically on exception, logs, etc. etc.

Jason


From: nginx [mailto:nginx-bounces at nginx.org] On Behalf Of Nicolas Legroux
Sent: Wednesday, December 06, 2017 4:48 PM
To: nginx at nginx.org
Subject: [IE] Can Nginx used as a reverse proxy send HTTP(s) requests through a forward proxy ?

Hi,

I'm wondering if it's possible to do what's described in the mail subject ?
I've had a look through Internet and docs but haven't been able to figure it out. The question is similar to the one that's asked here : https://stackoverflow.com/questions/45900356/how-to-configure-nginx-as-reverse-proxy-for-the-site-which-is-behind-squid-prox, but that thread doesn't provide an answer.
I've been able to do this with Apache and its ProxyRemote directive, but I can't figure out if this is doable with Nginx.


Thanks,

Nicolas

--

This message contains proprietary information from Equifax which may be confidential. If you are not an intended recipient, please refrain from any disclosure, copying, distribution or use of this information and note that such actions are prohibited. If you have received this transmission in error, please notify by e-mail postmaster at equifax.com. Equifax® is a registered trademark of Equifax Inc. All rights reserved.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20171207/8bf6ab9c/attachment.html>


More information about the nginx mailing list