On Thu, Mar 22, 2012 at 10:18 AM, J.Lance Wilkinson <jlw12@xxxxxxx> wrote: > I'm trying to extract part of a URI into an environment variable to use in > an authorization scheme (let's skip talking about how I'll USED that > variable for the moment). > > I have the following directives in my configuration: > > LogFormat "%h %l %u %t \"%r\" %>s %b UMG=%{UMG}e" umgs > CustomLog logs/umg.log umgs > ... > <Location ~ "^/(.*)/umg/.(.*)(.html|/(.*)?)$"> > ... > SetEnvIf REQUEST_URI "^/(.*)/umg/.(.*)(.html|/(.*)?)$" UMG=$2 > ... > </Location> > Why both locationmatch AND checking the request URI in setenvif? > When I watch that log file, and hit resources that match that location, I'm > seeing entries in the log which suggest a value for the UMG variable is not > being extracted: > > xxx.xxx.xxx.xxx - jlw12 [22/Mar/2012:09:31:13 -0400] "GET > /umgs/umg.up.dlt.sslcerts.mgttool HTTP/1.1" 301 455 UMG=- > xxx.xxx.xxx.xxx - jlw12 [22/Mar/2012:09:31:25 -0400] "GET > /umgs/umg.up.dlt.ul.gml.managers HTTP/1.1" 301 454 UMG=- > > I'd expected to see UMG=up.dlt.sslcerts.mgttool and > UMG=up.dlt.ul.gml.managers on these two log lines. > > Several thoughts come to mind: > 1) Logging is taking place before the SetEnvIf takes place. definitely not > 2) Miscoding of Location's regular expression is causing SetEnvIf to be > bypassed. easy to test, locationmatch not needed if you're already comparing against the URI in the setenvif. > 3) Miscoding of SetEnvIf's regular expression is causing SetEnvIf to fail. likely, the "pcretest" program says it doesn't match. This string would need either a .html or another / to match, right? @^/(.*)/umg/.(.*)(.html|/(.*)?)$@ /umgs /umg.up.dlt.sslcerts.mgttool (never found .html or /) Maybe you meant the ? to apply to the entire alternation and not the .*? > 4) Miscoding of SetEnvIf's value specification is causing failure. easy to test w/ a literal value, not likely the case though. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx