jamiequint.TakeThisOut@gmail.com wrote:
> I'm using nginx to proxy to apache and am setting a custom header in
> nginx (which is doing SSL) to tell apache if SSL is on or off. I am
> doing this by using a SetEnvIf directive to read the custom header
> then set the HTTPS environment variable in apache. However, it doesn't
> seem to be working and I'm not quite sure why. I know the header is
> getting set correctly (I analyzed the live headers to make sure it was
> being set) but still no luck. Here is what I have...
>
> SetEnvIf ^Secure_Request ^1 HTTPS=1
> SetEnvIf ^Secure_Request ^0 HTTPS=0
>
> (The header is named Secure_Request and appears in the headers as
> "Secure_Request: 1" if SSL is on. I have tried multiple other things
> as well e.g...
>
> SetEnvIf ^Secure_Request ^1 HTTPS
> SetEnvIf ^Secure_Request ^0 !HTTPS
>
> but still nothing. If I do
>
> SetEnv HTTPS 1
>
> to test it works as expected, but somehow HTTPS does not get set in
> the previous directives. Any suggestions would be greatly appreciated.
>
> Best,
> Jamie
I don't know why what you are doing doesn't work. Here is a possible
alternative using mod_rewrite (untested):
RewriteEngine on
RewriteCond %{HTTP:Secure_Request} ^1
RewriteRule .* - [E=HTTPS:1]
HTH,
Jim
>> Stay informed about: SetEnvIf question