'How to use X-Forwarded-Proto in Nginx Webserver

I have set X-Forwarded-Proto to the header. But Nginx as my webserver not using it and always assume the scheme is HTTP, even though I set the X-Forwarded-Proto to HTTPS

How to set Nginx to use X-Forwarded-Proto?

Note: Nginx here as a webserver not a reverse proxy



Solution 1:[1]

https://serverfault.com/a/875278/ is the clever way.

Since no https traffic can ever hit my receving vhost though (firewalled off from public net), I've instead set this alongside my fastcgi setup;

fastcgi_param HTTPS 'on';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kirrus