Re: Conditionally strip/remove a specific cookie from request

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

 



---- ohaya@xxxxxxx wrote: 
> 
> ---- Igor Cicimov <icicimov@xxxxxxxxx> wrote: 
> > On 10/12/2012 6:58 PM, <ohaya@xxxxxxx> 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@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