Skip to content

Instantly share code, notes, and snippets.

@darkcolonist
Created July 29, 2020 06:24
Show Gist options
  • Save darkcolonist/a53b950d063038a0b65caec41809d791 to your computer and use it in GitHub Desktop.
Save darkcolonist/a53b950d063038a0b65caec41809d791 to your computer and use it in GitHub Desktop.
redirect to https behind haproxy, behind loadbalancer, behind cloudflare
RewriteEngine On
RewriteCond %{HTTPS} off
# RewriteCond %{HTTP:X-Forwarded-Proto} !https # commenting this out because: cloudflare -> haproxyLoadbalancer -> php70server
RewriteCond %{HTTP:CF-Visitor} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
@darkcolonist
Copy link
Author

darkcolonist commented Jan 7, 2021

image
works with flexible, has some problems with full i think

January 07, 2021 11:07 am last tested with cloudflare > haproxy > app.server then no certificate issued using letsencrypt, ensure that cname has been created in cloudflare pointing to host

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