Skip to content

Instantly share code, notes, and snippets.

@adamxp12
Created March 1, 2016 19:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamxp12/97f833597e0ac539a2eb to your computer and use it in GitHub Desktop.
Save adamxp12/97f833597e0ac539a2eb to your computer and use it in GitHub Desktop.
Force SSL through htaccess when behind a proxy like varnish
# Force SSL when infront of a proxy like nginx or varnish
# Easier to do it in apache than at the proxy side as varnish is a pain 100% of the time to configure
# and no point configuring it in nginx as thats only the SSL terminator, at least in my setup
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://adamxp12.com/$1 [R,L]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment