views:

648

answers:

1

I need to remove a cookie from the HTTP request that gets to the server. Doing it on the client (that writes this cookie) or on the server (that reads it) is not an option. I have Apache 2.0 that proxies requests between client and the server, so I was hoping to remove the cookie right there in Apache using mod_rewrite.

My question is, is there a way to remove a certain cookie from the HTTP request using mod_rewrite?

If not possible to remove just one cookie then as a last resort to remove all cookies from the request?

I am open to other suggestions of how to accomplish this if mod_rewrite is not the right tool for this task.

+2  A: 

Apache mod_rewrite allows manipulation of URLs but not of HTTP headers, however 'mod_headers' will let you do that.

So, you could use:

RequestHeader unset Cookie

This will strip all cookies from the request. I'm not sure if its possible to remove just a particular cookie using this technique.

Alternatively, you an stop cookies being passed back to the client using:

Header unset Set-Cookie

if that's more appropriate.

Andy
It is possible to set cookies with mod\_rewrite. But as far as I know only for the response to the client.
Gumbo