Using X-Forwared-Proto
-
Hello, I had a problem with “Too many redirects” with my wordpress site sitting behind a reverse-proxy so I checked the
.htaccess
file contents:# BEGIN HTTPS Redirection Plugin <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> # END HTTPS Redirection Plugin
I was surprised to see that this file 1. Does not support reverse-proxies 2. Uses the port as a proxy to check the protocol.
Please note that the
%{HTTPS}
variable checks for the actual use of the HTTPS protocol and%{HTTP:X-Forwarded-Proto}
must be checked to support reverse-proxies.With the correct changes, the
.htaccess
file looks like this# BEGIN HTTPS Redirection Plugin <IfModule mod_rewrite.c> RewriteEngine On RewriteCond %{HTTP:X-Forwarded-Proto} !https RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] </IfModule> # END HTTPS Redirection Plugin
The page I need help with: [log in to see the link]
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Using X-Forwared-Proto’ is closed to new replies.