---- Igor Cicimov <icici...@gmail.com> wrote: 
> On Mon, Dec 10, 2012 at 11:02 AM, <oh...@cox.net> wrote:
> 
> >
> > ---- Igor Cicimov <icici...@gmail.com> wrote:
> > > On Mon, Dec 10, 2012 at 9:02 AM, <oh...@cox.net> wrote:
> > >
> > > >
> > > > ---- Igor Cicimov <icici...@gmail.com> wrote:
> > > > > On Mon, Dec 10, 2012 at 7:19 AM, <oh...@cox.net> 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-unsubscr...@httpd.apache.org
> > > > > > For additional commands, e-mail: users-h...@httpd.apache.org
> > > > > >
> > > > > >
> > > > > 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-unsubscr...@httpd.apache.org
> > > > For additional commands, e-mail: users-h...@httpd.apache.org
> > > >
> > > > True, so how about this ... You set the cookie if "env = condition1"
> > and
> > > then edit/unset/merge/ or do whatever if "env != condition2"
> >
> >
> > Hi,
> >
> > Thanks for the suggestion.  I guess that I'd really rather not set the
> > cookie then possibly have to unset it later.  That seems a little too
> > convoluted.
> >
> > What I was trying to find out with this post is about how something like
> > SetEnvIfExpr:
> >
> > http://httpd.apache.org/docs/trunk/mod/mod_setenvif.html#setenvifexpr
> >
> 
> That link has the word "trunk" in it which usually means "current
> development version". And if you check the bread crumbs in the top of the
> page you'll see
> 
> [image: <-] <http://httpd.apache.org/docs/trunk/mod/>
>  Apache <http://www.apache.org/> > HTTP Server <http://httpd.apache.org/> >
> Documentation <http://httpd.apache.org/docs/> > Version
> 2.5<http://httpd.apache.org/docs/trunk/>>
> Modules <http://httpd.apache.org/docs/trunk/mod/>
> 
> it is a Apache 2.5 module. If you need to use this feature AND <If> tags
> you need Apache 2.4
> 
> 
> >
> > might be used.
> >
> > Apparently this SetEnvIfExpr is available in Apache 2.2.9+?
> >
> > That page has some examples of using SetEnvIfExpr, e.g.:
> >
> > SetEnvIfExpr "tolower(req('X-Sendfile')) == 'd:\images\very_big.iso')"
> > iso_delivered
> >
> > plus, it links to this other page on expressions in Apache:
> >
> > http://httpd.apache.org/docs/trunk/expr.html
> >
> > which has examples of expressions:
> >
> > # Compare the host name to example.com and redirect to www.example.com if
> > it matches
> > <If "%{HTTP_HOST} == 'example.com'">
> >     Redirect permanent / http://www.example.com
> > </If>
> >
> > So I was thinking I could use something like that, but I'm not familiar
> > with these "expressions", so I was hoping that someone here could tell me
> > (or point the way to) the expression that I'd need to do what I described
> > in my original post.
> >
> > Also, BTW, I'm having problems with what was suggested in the message
> > thread on Stackoverflow.com in my original post.  I tried the suggested
> > RequestHeader, to try to remove a cookie in an incoming request, but it's
> > not working.  Rather it looks like it just replaces the entire "Cookie:"
> > header altogether.  FYI, for this testing, I have my Apache proxying
> > (ProxyPass/ProxyPassReverse) a Tomcat instance.
> >
> > Thanks,
> > Jim
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
> > For additional commands, e-mail: users-h...@httpd.apache.org
> >
> >


Hi Igor,

I realized that a little while ago, and just built 2.4.3, and yes, the <If> 
works, or at least it doesn't throw and error with that.

Any idea on what the expr should look like to do what I was asking about?  I'm 
still trying to figure that out.  If anyone knows, or maybe give me some hints, 
I'd appreciate that.

Thanks,
Jim


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

Reply via email to