You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Admin <ad...@mysk.org> on 2002/11/08 03:15:13 UTC

[users@httpd] Possible regex issue with SetEnvIf

Greetings, all.

I've been attempting to allow access to a virtual domain to a single wireless 
device (RIM 957 using Go.Web if it matters).  I'm running Apache 2.0.43 on 
Windows NT Server.

This device/browser combination sends a unique identifier in the 
HTTP_X_GA_SUBNO variable in the form of a triple-dotted number, in this case 
beginning "1.241"

Accordingly, I set up the following in http.conf:

In the virtual domain configuration I set
	SetEnvIf HTTP_X_GA_SUBNO "1*" its_me

The directory section for the domain root reads
     <Directory "F:/Nabiki">
         Options Indexes MultiViews
         AllowOverride None
         Order deny,allow
         deny from all
         allow from [my ip range]
         allow from env=its_me
     </Directory>

This configuration appears to allow any access regardless of the presence, 
absence, or content of the HTTP_X_GA_SUBNO variable.

Any attempt to restrict it further results in a 403.  I've tried the following 
syntaxes:
     SetEnvIf HTTP_X_GA_SUBNO "1\.*" its_me
     SetEnvIf HTTP_X_GA_SUBNO "1\.241*" its_me
     SetEnvIf HTTP_X_GA_SUBNO "1.241*" its_me
     SetEnvIf HTTP_X_GA_SUBNO "1\W241*" its_me
     SetEnvIf HTTP_X_GA_SUBNO "1*241*" its_me

At this point, I can only assume that either I've completely misunderstood the 
proper usage of SetEnvIf, there's a configuration setting I've missed 
somewhere, or that the combination of regex and SetEnvIf is broken under 2.0.43 
for Win32.

Can anyone suggest a possibility I've overlooked, or who can confirm my 
observations?

Thanks in advance,

	Steven Karp
--
Random blurb of the day:
Garry Gygax (spit) is hardly an authority on mythology --P. da Silva



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Possible regex issue with SetEnvIf

Posted by Admin <ad...@mysk.org>.
Witty, wise, weird, and wonderful, Joshua Slive wrote at Thu, 7 Nov 2002 
21:51:19 -0500 (Est):
>1. You need to read up a little more on regex.  "*" does not mean
>"match any character".  Rather, it means "match 0 or more of the
>previous character".  What you really want is "1.*" which means
>"match '1' followed by zero or more of any character.

You're absolutely right about my need to read up more on regex.  Adding it to 
the massive to-do list.

>2. Is the HTTP header actually called "HTTP_X_GA_SUBNO", or (more
>likely) is it actually called X-GA-SUBNO and you added the HTTP and
>substituted -
>with _ because you looked at the CGI env-variable.  SetEnvIf uses
>the actual header name, not the CGI env-variable name.

<ding!>  That was the problem.  I had actually tried X_GA_SUBNO, but I had 
totally missed the - to _ substitution.

OK, it's official: I'm an idiot.

Thanks for proving it gently.  <grin>

	S.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Possible regex issue with SetEnvIf

Posted by Joshua Slive <jo...@slive.ca>.
On Thu, 7 Nov 2002, Admin wrote:
> In the virtual domain configuration I set
> 	SetEnvIf HTTP_X_GA_SUBNO "1*" its_me

Two problems:

1. You need to read up a little more on regex.  "*" does not mean "match
any character".  Rather, it means "match 0 or more of the previous
character".  What you really want is "1.*" which means "match '1' followed
by zero or more of any character.

2. Is the HTTP header actually called "HTTP_X_GA_SUBNO", or (more likely)
is it actually called X-GA-SUBNO and you added the HTTP and substituted -
with _ because you looked at the CGI env-variable.  SetEnvIf uses the
actual header name, not the CGI env-variable name.

So, to sum up, try:
SetEnvIf X-GA-SUBNO "1.*" its_me

Joshua.


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org