Welcome! Log In Create A New Profile

Advanced

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

Posted by 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
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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 <[email protected]> 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
> nginx@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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 francis@daoine.org
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
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:[email protected]] On Behalf Of Nicolas Legroux
Sent: Wednesday, December 06, 2017 4:48 PM
To: nginx@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@equifax.com. Equifax® is a registered trademark of Equifax Inc. All rights reserved.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login