Created
September 18, 2017 11:22
-
-
Save ThijsFeryn/77c3b2e1425b1301448b05f5b547ea4c to your computer and use it in GitHub Desktop.
Force HTTPS redirect for sites behind a reverse (caching) proxy that terminates SSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SetEnvIf X-Forwarded-Proto "https" HTTPS=on | |
Header append Vary: X-Forwarded-Proto | |
<IfModule mod_rewrite.c> | |
RewriteEngine on | |
RewriteCond %{HTTPS} !=on | |
RewriteCond %{HTTP:X-Forwarded-Proto} !https [NC] | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] | |
</IfModule> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment