I'm setting this in my vhost in Apache 2.4
SetEnvIf X-Forwarded-Proto https HTTPS=on
And in my .htaccess I add this rule :
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [R=301,L]
but I get an infinit loop since my RewriteCond doesn't see the value of HTTPS.
I do a phpinfo(INFO_VARIABLES);
and I get $_SERVER['HTTPS'] on
I had debug in my errorLog to get this RewriteCond: input='off' pattern='off' => matched
As you see the RewriteCond doesn't see the value I set.
I read some doc as
The SetEnv directive runs late during request processing meaning that directives such as SetEnvIf and RewriteCond will not see the variables set with it.
And what I did is supposed to work.
What's wrong ? Thanks ;)