listen proxy_protocol and rewrite redirect scheme

adrhc nginx-forum at forum.nginx.org
Fri Sep 16 15:12:16 UTC 2016


Hi, I have this setup:

the browser request (https on 443) is received by sshttp which sends it to
stunnel:1443 which proxy it to nginx:1080.
When nginx receives the request it has $scheme = "http"; so, for any rewrite
with "permanent" or "redirect" the Location header uses "http" while I
really need "https" scheme.

Is there any way for forcing nginx to change $scheme according to my will? 
or at least to generate the Location header with no scheme or with my
desired scheme?

Thank you

nginx configuration:
	server {
		listen 127.0.0.1:1080 proxy_protocol;
		port_in_redirect		off;
		server_name_in_redirect	off;
		...
	}

stunnel configuration:
[tls]
accept = ************:1443
connect = 127.0.0.1:1080
protocol = proxy
[ssh]
sni = tls:tti.go.ro
...
[www on any]
sni = tls:*
connect = 127.0.0.1:1080
protocol = proxy

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,269623,269623#msg-269623



More information about the nginx mailing list