httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <oh...@cox.net>
Subject Re: [users@httpd] Conditionally strip/remove a specific cookie from request
Date Thu, 01 Jan 1970 00:00:00 GMT

---- ohaya@cox.net wrote: 
> 
> ---- Igor Cicimov <icicimov@gmail.com> wrote: 
> > On 10/12/2012 6:58 PM, <ohaya@cox.net> wrote:
> > >
> > >
> > > > >
> > > > Try
> > > > RequestHeader edit "Cookie" "MyCookie=.*(\;)?"
> > > >
> > > > Anyway, more interesting question for me was how are you going to check
> > for
> > > > the first condition, existance of the arbiteary header MYHEADER? Or you
> > are
> > > > talking here about standard http header?
> > > >
> > > > > which I thought SHOULD work, but it doesn't.
> > > > >
> > > > > Anyone?  Any regex experts out there?  I know that I'm TERRIBLE with
> > them
> > > > :(...
> > > > >
> > > > > Thanks,
> > > > > Jim
> > >
> > > Igor,
> > >
> > > Thanks for your suggestion, but it:
> > >
> > > 1) Leaves a trailing semicolon if the cookie I want to remove is at the
> > very end of the "Cookie" value/string, and
> > > 2) Removes the cookie I want to remove and everything after that if the
> > cookie I want to remove is not at the very end of the "Cookie" value/string.
> > >
> > > Re. your question: I probably didn't explain clearly what I meant by an
> > arbitrary MYHEADER.  We know what that header name is, so it's "arbitrary"
> > in the sense that it'll be what we need, but it's not one of the standard
> > HTTP headers.
> > >
> > > Jim
> > 
> > Why dont you paste your config here so we can see what have you done?
> 
> 
> Igor,
> 
> As I said earlier, right now, I'm focusing on trying to get the "RequestHeader edit"
working (I think that now that I have 2.4.3 and the <If>, the conditional part shouldn't
be too bad), so I have a vanilla, just-built 2.4.3, with the following <Location> added:
> 
> <Location /test>
> # Compare the host name to foo.whatever.com and add a header in that case...
> <If "%{HTTP_HOST} == 'foo.whatever.com'">
>     RequestHeader set YOU_ARE_GOING_2FOO.WHATEVER.COM  AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAa
> 
> # Suggested by Igor from httpd mailing list - doesn't work
> #RequestHeader edit Cookie "MyCookie=.*(\;)?" ""
> 
> # 2nd suggestion from Igor - doesn't work
> RequestHeader edit "Cookie" "MyCookie=.*(\;)?$" ""
> 
> </If>
> 
> ProxyPass       http://localhost:8080/test
> ProxyPassReverse        http://localhost:8080/test
> 
> </Location>
> 
> Jim


Igor (et al),

For the record, "Salman A" over on stackoverflow posted a regex that works:

RequestHeader edit Cookie "(^MyCookie=[^;]*;|; MyCookie=[^;]*)" ""

Thanks for hanging in there with me on this one!!

Jim

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message