How to set X-Forwarded-Proto header in nginx

Directly after any proxy_pass line add

proxy_set_x_forwarded_proto.conf
proxy_set_header X-Forwarded-Proto $scheme;

Typically X-Forwarded-Proto is used together with X-Forwarded-Host like this:

example.txt
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Proto $scheme;

 


Check out similar posts by category: Networking, Nginx, Wordpress