Mark Harris
Mark Harris

Reputation: 1

nginx https forward proxy

0

I know that NGINX is not supposed to be used as a forward proxy but I have a requirement to do so. I have http working as a forward proxy but issues arise when trying to configure https. I generated the required SSL certs and then try to connect to https://www.google.com and it gives me the error ERR_TUNNEL_CONNECTION_FAILED. I understand I can't use the CONNECT method and must use an https_proxy or stream module to do this. Does anyone have some sample code to achieve this functionality?

server {
    listen 443 ssl;
    root /data/www;

    ssl on;
    ssl_certificate /etc/ssl/certs/server.crt;
    ssl_certificate_key /etc/ssl/certs/server.key;

    ssl_protocols  TLSv1 TLSv1.1 TLSv1.2;
    ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
    ssl_prefer_server_ciphers on;

    location / {
            resolver 8.8.8.8;
            proxy_pass https://$http_host$uri$is_args$args;
    }

    stream {
        upstream web_server {
               server my_server_listening_on:443;
        }

    server {
        listen 443;
        proxy_pass web_server;
    }
}

Upvotes: 0

Views: 44

Answers (0)

Related Questions