passing header information on to backend Apache/PHP
gmm at csdoc.com
Sun Apr 5 19:26:25 MSD 2009
On Sunday, April 5, 2009 at 16:02:34, Peter Langhans wrote:
PL> My problem is, that I need my php scripts to know
PL> in some way or another whether SSL is used or not
PL> When using nginx as webfrontend proxy, it accepts all the ssl
PL> connections and it's working fine, but when I proxy through to
PL> apache, the knowledge about SSL is 'lost'. If possible, I don't
PL> want to be using different ports for proxying through to apache.
PL> Does anyone have an idea how I can get any custom set header,
PL> set in the nginx.conf through to the php scripts?
proxy_set_header X-Nginx-Scheme $scheme;
# nginx variable $scheme will be 'http' or 'https'.
SetEnvIf X-Nginx-Scheme "^https$" HTTPS=on
# Apache environment variable HTTPS will be 'on' or not defined.
$scheme = getenv('HTTPS') && strtolower(getenv('HTTPS')) != 'off'
# PHP variable $scheme will be 'http' or 'https'.
More information about the nginx