Welcome! Log In Create A New Profile

Advanced

nginx as backend: handle X-Forwarded-Proto (similar to NginxHttpRealIpModule / X-Real-Ip)

Daniel Hahler
October 07, 2009 07:04AM
Hi,

when using nginx as backend, it would be useful to handle
X-Forwarded-Proto in the same way X-Forwarded-For / X-Real-Ip can be
handled, e.g.:

frontend:
proxy_set_header X-Forwarded-Proto $scheme;

backend:
set_scheme_from 10.122.1.80;
real_scheme_header X-Forwarded-Proto;


E.g. webfaction appears to use X-Forwarded-Ssl instead, which is "on"
if activated (see http://www.cherrypy.org/changeset/1980).

It would be nice, if nginx would handle "http", "https", "on" and
"off" as value given in real_scheme_header, or add real_ssl_header to
handle the "on"/"off"(?) case.

Currently I'm using the following in the backend config, which is good
enough as workaround, but just using $scheme here is preferred, of
course:
if ($http_x_forwarded_proto != "https") {
rewrite ^(.*)$ https://$server_name$1 permanent;
}


Thanks,
Daniel

--
http://daniel.hahler.de/
Subject Author Posted

nginx as backend: handle X-Forwarded-Proto (similar to NginxHttpRealIpModule / X-Real-Ip)

Daniel Hahler October 07, 2009 07:04AM

Re: nginx as backend: handle X-Forwarded-Proto (similar to NginxHttpRealIpModule / X-Real-Ip)

Daniel Hahler May 07, 2010 11:26AM

Re: nginx as backend: handle X-Forwarded-Proto (similar to NginxHttpRealIpModule / X-Real-Ip)

Igor Sysoev May 07, 2010 05:16PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 209
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