I have a website running on a LEMP stack. I have enabled cloudflare with the website. I am using the cloudflare flexible SSL certificate for https. When i open the website in ch
I tried
if ($http_x_forwarded_proto = "http") {
return 301 https://$server_name$request_uri;
}
But this not allways redirected. Manually write address in browser with begining http:// and nginx not redirected. But using $scheme it's working even manually entering http:// So (for my site) is always working variant:
if ($scheme = "http") {
return 301 https://$server_name$request_uri;
}
P.S. sorry for my english :(