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;        }
        if (req.request != "GET" && req.request != "HEAD") 
{        return (pass);        }  
      if (req.http.x-forwarded-for) {        
set req.http.X-Forwarded-For = req.http.X-Forwarded-For ", " client.ip;  
      }        else {      
  set req.http.X-Forwarded-For = client.ip;        }


    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;     }    else  
  {    pass;    }}sub vcl_pipe {return (pipe);}sub 
vcl_pass {return (pass);}

sub vcl_hit{   set obj.ttl=7d;}sub vcl_deliver {      
          remove resp.http.Via;      
          remove resp.http.X-Varnish;    
            remove resp.http.server;    
    if (obj.hits > 0) {            
    set resp.http.X-Cache = "MIC-HIT";        } 
else {                set 
resp.http.X-Cache = "MIC-MISS";        }    
return (deliver);}...----- 原始邮件 -----
发件人:Andrea Campi <[email protected]>
收件人:[email protected]
主题:Re: puzzle about unset req.http.cookie
日期:2011-6-20 16:47:52

2011/6/20  <[email protected]>:

> &nbsp;Hello everyone,

> I do not know where to ask my question &nbsp;so I send it here. thanks 
> everyone.

> I hava questions about &nbsp;req.http.cookie:

> I see some configuration on google like this:

> if(req.url ~ ".(js|css|jpg|png|gif|swf|jpeg|ico)$){

> unset req.http.cookie;

> }

> it says if images have cookie,It can not be cached.

> but I do not set this in my configuration, I still saw&nbsp;CACHE-HIT

> (resp.http.X-Cache = "CACHE-HIT") in http response.

> anyone could explain &nbsp;this?



You probably have something else in your VCL that allows caching.

Send the whole VCL, we can't just guess.



Andrea

_______________________________________________
varnish-dev mailing list
[email protected]
http://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to