Welcome! Log In Create A New Profile

Advanced

nginx behind corporate proxy

Posted by kdinluks 
nginx behind corporate proxy
December 14, 2016 09:17PM
How do I configure nginx to proxy connections through a corporate proxy using HTTP when the proxied server uses HTTPS?

For example:
My corporate proxy: http://corporate-proxy.my-corporate.com:8080
Resource server: https://my-api.internal-address.my-corp.com

With curl I could do: curl -X GET -x "http://corporate-proxy.my-corporate.com:8080" "https://my-api.internal-address.my-corp.com"

With nginx I've tried:

upstream corporate_proxy {
server corporate-proxy.my-corporate.com:8080;
}

location /_internal/_resource
{
proxy_buffering off;
proxy_pass_header on;
proxy_set_header Host "my-api.internal-address.my-corp.com:443";
proxy_pass http://corporate_proxy;
}

But I get a 504 Gateway timeout as response.
My guess is that nginx is trying to use HTTP over the port 443 and therefore the server is not replying back or throwing some error.
How do I tell nginx to use HTTPS even though the corporate proxy is using HTTP?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 152
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready