Skip to content

Instantly share code, notes, and snippets.

@khanhicetea
Created November 5, 2015 07:26
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save khanhicetea/b8555ea0a620e38aa361 to your computer and use it in GitHub Desktop.
Save khanhicetea/b8555ea0a620e38aa361 to your computer and use it in GitHub Desktop.
NginX https redirect ( Cloudflare's flexible ssl )
server {
listen 80;
server_name example.com www.example.com;
if ($http_x_forwarded_proto = "http") {
return 301 https://$server_name$request_uri;
}
... directives to generate a response
}
@darkcolonist
Copy link

this is brilliant! i didn't have to use $scheme and some of the scripts cause redirect loops!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment