This is an apache question. I set a header in my config files with RequestHeader. (local apache install) I can see that works as per the output of a custom php script to dump headers: the header is there.
However a rule based on that header being present is not fulfilled in .htaccess. The same .htaccess file works as expected on another server.
My added request header doesn't seem to be visible in .htaccess. Any idea?
Apache conf:
RequestHeader set X-Forwarded-Proto "https"
.htaccess:
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
That loops forever. But it works perfectly on a config behind an AWS load-balancer.
Thanks for helping agent420.
I finally found the solution... It takes either a clear understanding of Apache processing rules or some luck (latter in my case).
The working directive is:
RequestHeader set X-Forwarded-Proto "https" early
High, unsubtle, massive emphasis on the word 'early'. That's all it took... Hope that comes of some use to others. Teebo