The original post: /r/nginx by /u/Powerful-Internal953 on 2024-09-04 06:26:57.
Due to an unusual situation, I need to setup an upstream that is behind a corporate proxy. So far, I am trying this.
My nginx serves abc.example.com
And I want abc.example.com/xx/yy/(.*).js to be served from xyz.example.com/yy/(.*).js . But the problem right now is that the xyz.example.com is behind http://corporate-proxy.example.com:8080 . How do I get this setup to work? Currently I have something like below.
upstream corporate-proxy {
server corporate-proxy.com:8080;
}
location /xx/yy/zz {
rewrite ^//xx/yy/zz/(.*)$ /zz/$1 break;
proxy_pass http://corporate-proxy;
proxy_set_header Host xyz.example.com:443;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
However, my requests are being sent to xyz.example.com over port 443 but being sent as HTTP requests instead of HTTPS requests. keep getting 400 The plain HTTP request was sent to HTTPS port
.
Any way to correct this in such a way that the proxy would work with the right port? Tried changing the proxy_pass to https but that doesn’t help
You must log in or register to comment.