回复:Re: puzzle about unset req.http.cookie
yangxu4000 at sina.com
yangxu4000 at sina.com
Mon Jun 20 10:56:57 CEST 2011
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 <andrea.campi at zephirworks.com>
收件人:yangxu4000 at sina.com
主题:Re: puzzle about unset req.http.cookie
日期:2011-6-20 16:47:52
2011/6/20 <yangxu4000 at sina.com>:
> Hello everyone,
> I do not know where to ask my question so I send it here. thanks everyone.
> I hava questions about 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 CACHE-HIT
> (resp.http.X-Cache = "CACHE-HIT") in http response.
> anyone could explain this?
You probably have something else in your VCL that allows caching.
Send the whole VCL, we can't just guess.
Andrea
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-dev/attachments/20110620/d7bae4d7/attachment-0003.html>
More information about the varnish-dev
mailing list