unset req.http.Cookie and TxHeader

Chris Hecker checker at d6.com
Fri Jul 16 22:04:51 CEST 2010

Digging a bit more, I'm still getting these pages cached, which wouldn't 
happen if they had cookies, no?  Then I found this in my vcl (which I've 
cobbled together from various ones I've found without really 
understanding it all, my bad):

sub vcl_pipe {
         # do the right XFF processing
         set bereq.http.X-Forwarded-For = req.http.X-Forwarded-For;
         set bereq.http.X-Forwarded-For = 
regsub(bereq.http.X-Forwarded-For, "$", ", ");
         set bereq.http.X-Forwarded-For = 
regsub(bereq.http.X-Forwarded-For, "$", client.ip);
         set bereq.http.Cookie = req.http.X-Orig-Cookie;
         set bereq.http.connection = "close";

The vcl_recv is copying req.http.Cookie to X-Orig-Cookie, and then 
clearing it, presumably to get caching, but then this restores it just 
for the backend request.

This came from a vcl recommended by the mediawiki folks, I think.

I need to sit down and really figure out what I need to be doing here. 
I've got a single vcl feeding wordpress and mediawiki, and I've got some 
cookie wonkiness, but things mostly work, so I'm reticent to touch it.


On 2010/07/16 12:34, Ken Brownfield wrote:
> Yes, I believe the structures are all populated before vcl_recv, so you need to unset the bereq header.  It also makes more sense conceptually, IMHO.

More information about the varnish-misc mailing list