How do you confirm cookies are removed from static files?

Tollef Fog Heen tfheen at varnish-software.com
Thu Sep 30 07:52:25 CEST 2010


]] Chris Altman 

| I am new to Varnish and have read the documentation. My goal is to remove all cookies from static files. I am using Varnish 2.1.3
| 
| My VCL is:
| 
| sub vcl_recv {
|   if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
|     unset req.http.cookie;
|   }
| }
| 
| sub vcl_fetch {
|   if (req.url ~ "\.(png|gif|jpg|swf|css|js)$") {
|     unset beresp.http.set-cookie;
|   }
| }

This looks fine.

| I am confused because it appears the static files are served from
| Varnish but still have a cookie in their Request Headers. How do I
| remove the Request Headers cookie? Am I still gaining the benefits of
| Varnish if the Request Headers cookies exist?

If you use varnishlog to look at the request sent to the backend, you'll
notice that it does not have a Cookie header sent with it.  Varnish
obviously can't change what the client sends to Varnish, only what it
forwards to the backend.

-- 
Tollef Fog Heen
Varnish Software
t: +47 21 54 41 73




More information about the varnish-misc mailing list