Re: 回复:Re: puzzle about unset req.http.cookie

Andrea Campi andrea.campi at zephirworks.com
Mon Jun 20 11:24:08 CEST 2011


2011/6/20  <yangxu4000 at sina.com>:
> Hi,
> this is my configuration, thanks~
> backend www {
> .host = "xx.xx.xx.xx";
> .port = "80";
> .connect_timeout = 60s;
> .first_byte_timeout = 10s;
> .between_bytes_timeout = 5s;
> }
> sub vcl_recv {
>         if ( req.http.host ~ "^xxx.com") {
>         set req.backend = www;
>         }
>         else
>         {
>         error 404 "not allowed hostname";
>         }
>         if (req.request == "GET" && req.url ~
> "\.(js|css|jpg|png|gif|swf|jpeg|ico)$") {
>         unset req.http.cookie;
>         }

So there you go, you are in fact stripping cookies

>
>     if (req.request == "GET" && req.url !~ "/images/captcha\.gif" &&
> (req.url ~ ".(js|css|jpg|png|gif|swf|jpeg|ico)$"  || req.url ~ "/images/.*"
> || req.url ~ "/files/.*"  || req.url ~ "/javascripts/.*" || req.url ~
> "/stylesheets/.*"  ||  req.url ~ "^/gwt/.*" ) ) {
>         lookup;
>      }

Depending on which request you're testing with, you may be hitting
this, or falling through the end of the proc and hitting the default
logic (which will do the lookup anyway).

So to summarize, you are stripping cookies, and you are caching
images. It seems you are already doing what you wanted to do?




More information about the varnish-dev mailing list