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

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Nicolas Legroux
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

--


_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Can Nginx used as a reverse proxy send HTTP(s) requests through a forward proxy ?

Peter Booth
Take a look at the stream directive in the nginx docs. I’ve used that to proxy an https connection to a backend when I needed to make use of preecisting SSO 

Sent from my iPhone

On Dec 6, 2017, at 5:47 PM, Nicolas Legroux <[hidden email]> wrote:

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

--

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx

_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

Re: Can Nginx used as a reverse proxy send HTTP(s) requests through a forward proxy ?

Francis Daly
In reply to this post by Nicolas Legroux
On Wed, Dec 06, 2017 at 10:47:45PM +0000, Nicolas Legroux wrote:

Hi there,

> I'm wondering if it's possible to do what's described in the mail subject ?

No.

nginx does not speak the proxy-http protocol.

You can: use something other than nginx; or change your forward proxy
to be configured in "transparent" mode so that it is not expecting to
be addressed as a proxy; or change your clients to speak the proxy-http
protocol to an nginx that is configured as a "stream" pass-through and
not as a http server.

Depending on your requirements, I would suggest one of the first two.

        f
--
Francis Daly        [hidden email]
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx
Reply | Threaded
Open this post in threaded view
|

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

Jason Whittington
In reply to this post by Nicolas Legroux

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:[hidden email]] On Behalf Of Nicolas Legroux
Sent: Wednesday, December 06, 2017 4:48 PM
To: [hidden email]
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 [hidden email]. Equifax® is a registered trademark of Equifax Inc. All rights reserved.
_______________________________________________
nginx mailing list
[hidden email]
http://mailman.nginx.org/mailman/listinfo/nginx