Re: SetEnvIf failure or success?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Good morning Lance,

    I don't think your regexp is quite right. You could test it out with
grep or sed or something by echoing in the string from the log.

    You have:

"^/(.*)/umg/.(.*)(.html|/(.*)?)$"

    I think you mean:

"^/(.*)/umg\.(.*)(.html|/(.*)?)$"

    That is, I believe you want to backslash the period after umg to treat
it as a literal, rather than having a forward slash which is not in
your example strings.

    I'm not completely sure about the (.html|/(.*)?) part because I'm not
sure what you're trying to do there. I'm wondering if you mean to have
the question mark outside of the outer parentheses, but it may be
perfectly correct as you have it, I just don't know.

    But at least you need to make the one change, and see what happens.

> 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>
>
> 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.
> 2) Miscoding of Location's regular expression is causing SetEnvIf to be
>       bypassed.
> 3) Miscoding of SetEnvIf's regular expression is causing SetEnvIf to fail.
> 4) Miscoding of SetEnvIf's value specification is causing failure.
>
> Apache 2.2.6, so I don't have the luxury of setting up debug level logging
> for
> mod_setenvif; I also don't have immediate access to the source used for
> mod_setenvif so I can't say FOR CERTAIN that it's v2.0.51 or later such
> that
> the $2 in the value specification is legitimate.
>
> Is there anything obvious in these directives that would bear out one of
> these
> suspicions, or would point in a different direction?
>
> --
> J.Lance Wilkinson ("Lance")           InterNet: Lance.Wilkinson@xxxxxxx
> Systems Design Specialist - Lead      Phone: (814) 865-4870
> Digital Library Technologies          FAX:   (814) 863-3560
> E3 Paterno Library
> Penn State University
> University Park, PA 16802
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux