I've got something like this:
server {
listen 80;
listen [::]:80;
listen xxx.xxx.xxx.xxxx:443 ssl;
listen [xxxx:xxxx::xx:xxxx]:443 ssl;
server_name hostname.tld www.hostname.tld
location / {
# Apache is listening here
proxy_pass http://127.0.0.1:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# Set HTTPS flag for mod_rpaf
proxy_set_header X-Forwarded-HTTPS on;
}
}
What I'd like to do is conditionally set X-Forwarded-HTTPS when SSL is in use so I can reuse the server for both http/https and keep my configs nice and compact. So far haven't had any success. Anyone do this successfully?