httpd-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [Bug 55039] New: "RequestHeader edit" can't access environment variables
Date Fri, 31 May 2013 20:59:42 GMT

            Bug ID: 55039
           Summary: "RequestHeader edit" can't access environment
           Product: Apache httpd-2
           Version: 2.2.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: mod_headers


First of all, let me give you some context. The Apache 2.2's webpage which
describes mod_headers' "RequestHeader" directive says (specifically for the
"edit" action):

    RequestHeader edit header value replacement [early|env=[!]variable]
    If this request header exists, its value is transformed according to a
regular expression search-and-replace. The value argument is a regular
expression, and the replacement is a replacement string, which may contain
backreferences. Both a value and a replacement are a regular expression and a
replacement string respectively.

That's fine, but I faced a situation in my production environment where I had
two JSESSIONIDs defined in the "Cookie" header (don't ask me why) and this was
confusing the load balancing algorithm (mod_proxy_balancer). Without getting
into too much details, what I had to do was to clean up the "Cookie" header to
leave there only the JSESSIONID that I need. This is how I thought I could do

    SetEnvIf Cookie "JSESSIONID=([^;]+\.server.)" MYSESSIONID=$1
    RequestHeader edit* Cookie "(^JSESSIONID=[^;]+; |; JSESSIONID=[^;]+)" ""
    RequestHeader edit Cookie "(.*)" "$1; JSESSIONID=%{MYSESSIONID}e"

The first two lines above work fine, but unfortunately the last one doesn't
because the "RequestHeader edit" directive cannot reference environment
variables in its replacement string (why?). :~(

If I understood correctly what the webpage mentioned above says, the
replacement string is just that (a fixed string) which may also contain
backreferences to groups in the value's regular expression, however, since I
was trying to append the content of an environment variable there (in this case
MYSESSIONID), I ended up with, for instance, the following result (which is not
what I wanted):

    Cookie: language=en;
customer_type=Residential; JSESSIONID=%{MYSESSIONID}e

I was looking for something like this:

    Cookie: language=en;
customer_type=Residential; JSESSIONID=60685FA3BC4F0345196D00BFBFBFFC79.server2

Please, would it be possible to add this capability to the "RequestHeader edit"
directive so we would be able to use environments variables inside the
replacement string as well?

Thanks a lot!

PS: I'm running Apache 2.2.3 on RHEL 5.7

You are receiving this mail because:
You are the assignee for the bug.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message