Re: Conditionally strip/remove a specific cookie from request

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

 



On Mon, Dec 10, 2012 at 9:02 AM, <ohaya@xxxxxxx> wrote:

---- Igor Cicimov <icicimov@xxxxxxxxx> wrote:
> On Mon, Dec 10, 2012 at 7:19 AM, <ohaya@xxxxxxx> wrote:
>
> > Hi,
> >
> > We are trying to have an Apache (acting as a proxy) conditionally
> > strip/remove a cookie from the incoming request, before it proxies the
> > request.
> >
> > The condition is that, on the incoming request:
> >
> > - there is a specific HTTP header, MYHEADER, with a value of
> > "MYHEADERVALUE", and
> > - the root of the request URL's hostname (e.g., if hostname in the request
> > URL is "www.foo.com", then root is ".foo.com") matches a certain string,
> > e.g., ".whatever.com"
> >
> > If the conditions above are true, then we want to remove a cookie named
> > "MYCOOKIE" from the incoming request, before forwarding the request onto
> > the proxied host.
> >
> > I think that if the conditions match, according to this:
> >
> > http://stackoverflow.com/questions/1798431/how-to-remove-a-cookie-in-apache
> >
> > something like:
> >
> > RequestHeader add Cookie "MYCOOKIE='';expires='SOME_PAST_DATE';
> > Path=COOKIE_PATH"
> >
> > would remove the cookie, but I'm not sure how to construct the
> > _expression_/expr that says something like this:
> >
> > <If hostname_root==whatever.com && MYHEADER=<some_string>>
> >         RequestHeader add Cookie "MYCOOKIE=';expires='SOME_PAST_DATE';
> > Path=COOKIE_PATH"
> > </If>
> >
> > Also, I'm not sure what that "SOME_PAST_DATE" should be.
> >
> > Can anyone here tell me?
> >
> > Thanks,
> > Jim
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
> > For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx
> >
> >
> Use SetEnvIf


Igor,

I think that I can use SetEnvIf to set environment variables for each of the two conditions, but doesn't the RequestHeader directive only take only a single condition, e.g., "env=condition1"?

Jim

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

True, so how about this ... You set the cookie if "env = condition1" and then edit/unset/merge/ or do whatever if "env != condition2"

[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