Welcome to HostingForumz.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

SetEnvIf question

 
   Web Hosting Problem Solving Community! (Home) -> Apache RSS
Next:  error running ab  
Author Message
jamiequint

External


Since: Jan 20, 2008
Posts: 4



(Msg. 1) Posted: Mon Feb 18, 2008 5:00 pm
Post subject: SetEnvIf question
Archived from groups: alt>apache>configuration (more info?)

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

 >> Stay informed about: SetEnvIf question 
Back to top
Login to vote
jamiequint

External


Since: Jan 20, 2008
Posts: 4



(Msg. 2) Posted: Mon Feb 18, 2008 10:49 pm
Post subject: Re: SetEnvIf question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On Feb 18, 8:52 pm, Jim Hayter <see.reply....TakeThisOut@nowhere.invalid> wrote:
> jamiequ....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

Jim,

I ended up figuring out that the header was only being set in half the
requests and that is where my problem was. Thanks for the alternate
suggestion.

Best,
Jamie

 >> Stay informed about: SetEnvIf question 
Back to top
Login to vote
Jim Hayter

External


Since: Feb 07, 2005
Posts: 98



(Msg. 3) Posted: Mon Feb 18, 2008 11:52 pm
Post subject: Re: SetEnvIf question [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
SetEnvif - Hi, I'm using setenvif to avoid loggein some entries in my log-file (I'm using Apache 1.3.19). My httpd.conf looks like: ... SetEnvIf Request_URI "^\/servlet.*" servletlog CustomLog /u01/app/oracle/product/iAS/Apache/Apache/logs/access_log ...

SetEnvIf troubles - I'm trying to avoid having to create single line entries in my config for files that I don't want to log, but I'm having a bit of trouble getting there. If I use this entry below, it gets ignored and all the files in that folder get logged SetEnvIf..

Need help with SetEnvIf and regexes - Hi, I'm trying to put some unwanted requests in an alternative log file but I'm new to regexes and can't seem to get it right. I have the following in my http.conf file - can somebody tell me what I'm doing wrong? Things like the CONNECT and SEARCH...

SetEnvIf Referer - Hi All, I been trying to get this to work in apache 1.3.29_3 with freebsd 4.10 with no luck. Basically I want users to only be able to access this site if they come from a certain site (referer). This works perfectly fine when accessing *.htm, *.html,....

How to use %>s status line in SetEnvIf ? - Anyone know how to get the Status code in the LogFormat %>s to be visible in the SetEnvIf statement in the httpd.conf (or htaccess)? I tried using this and it doesn't work: SetEnvIf %>s 206 let_me_in I'm trying to restrict PDF download access fr...
   Web Hosting Problem Solving Community! (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]