3

I am trying to setup a nginx server that forwards the incoming request to a corporate porxy (its a mcafee proxy) with a proxy header Host and the actual destination host something like proxy_set_header Host xyz.com:443.

This works perfectly fine for http requests but not for https

here is my nginx.conf (assuming no proxy auth required)

server {
        listen       80;
    location /test/ {
        proxy_pass http://my-corporate-proxy:8080/;
        proxy_set_header Host mytargetdomain.com:443;
    }

here my expectation is when i hit http://localhost:80/test/api/health the request should go to nginx and then to http://my-corporate-proxy:8080/api/health with Host header and from my proxy it should initiate a https request like https://mytargetdomain.com/api/health.

but this doesnt happening in case of https.

is there any way I can make it work ? or if I make nginx honour system proxy that should also fine.

Thanks in advance.

1 Answers1

0

This setting might work. The proxy setting of OS must allow the nginx service go through. i.e. If Windows Nginx + Proxifier, in the Proxifier menu, [Profile][Advanced][Sevices and other users]...options, must be checked to enable nginx service pass.

http{

...

upstream service_behind_proxy { server my-corporate-service-behind-proxy:8080; }

server { listen 80;

    location /test/ {
        proxy_pass http://service_behind_proxy;
        proxy_set_header Host mytargetdomain.com:443;
    }

}

Jerry
  • 101