Currently (as with WebFaction did too) Apache sees all requests as HTTP requests because of the Nginx proxy in front. Is it possible for Nginx to pass something along to Apache to tell it that the real request was for HTTPS or not?
The main issue is that using basic Redirect
s in .htaccess
files trigger extra redirects, which can cause browser warnings and other issues, for example if an image redirect goes from https -> http -> https.
Example, if you have HTTPS redirect turned on in Site Route, the following will happen:
.htaccess
Redirect 301 /page/ /other-page/
results in
GET http://domain.com/page/
301 https://domain.com/page/
301 http://domain.com/other-page/
200 https://domain.com/other-page/
Note the extra https
back to http
redirect there.
To work around this you must add this to .htaccess
and complicate the redirects
RewriteCond %{HTTPS} on [OR]
RewriteCond %{HTTP:X-Forwarded-SSL} on
RewriteRule ^ - [env=ssl:s]
RewriteRule ^page/?$ http%{ENV:ssl}://%{HTTP_HOST}/other-page/ [R=301,L]
Thank you.