Welcome! Log In Create A New Profile

Advanced

Re: Nginx reverse proxy in front of corporate proxy

Maxim Dounin
June 04, 2021 12:08PM
Hello!

On Fri, Jun 04, 2021 at 06:20:57AM -0400, Flinou wrote:

> Hello!
>
> I did some research and couldn't find anything similar on the forum, sorry
> if I'm wrong.
>
> I would like to setup something like :
>
> Client -> https://my-nginx.com -> http://corporate-proxy.com (corporate
> proxy) -> https://website.com (website to reach)
>
> Doing curl command like
> curl -v https://website.com -x http://corporate-proxy.com works fine
>
> I tried something like
>
> location /test {
> proxy_set_header Host https://website.com;

A side note: the Host header syntax is wrong here, it should be
just "website.com". Correct syntax is not going to help here
though, see below.

> proxy_pass http://corporate-proxy.com:3128;
> }
>
> The corporate proxy does not allow me to access https://website.com in this
> case.
>
> Rewriting is not, for my use case, a satisfying alternative because of the
> 302 return code.
>
> Is there any way to achieve this ?

No. Unlike curl, nginx proxy_pass does not work through forward
proxies. If you want to pass requests to a backend server, you
have to connect to the server directly, or configure a dedicated
reverse proxy or tunnel to do so.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx reverse proxy in front of corporate proxy

Flinou June 04, 2021 06:20AM

Re: Nginx reverse proxy in front of corporate proxy

Maxim Dounin June 04, 2021 12:08PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 73
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready