<div>Hi,</div><div>this is my configuration, thanks~</div><div>backend www {</div><div>.host = "xx.xx.xx.xx";</div><div>.port = "80";</div><div>.connect_timeout = 60s;</div><div>.first_byte_timeout = 10s;</div><div>.between_bytes_timeout = 5s;</div><div>}</div><div>sub vcl_recv {</div><div><br></div><div> if ( req.http.host ~ "^xxx.com") {</div><div> set req.backend = www;</div><div> }</div><div> else</div><div> {</div><div> error 404 "not allowed hostname";</div><div> }</div><div><br></div><div> if (req.request == "GET" && req.url ~ "\.(js|css|jpg|png|gif|swf|jpeg|ico)$") {</div><div> unset req.http.cookie;</div><div> }</div><div><br></div><div> if (req.request != "GET" && req.request != "HEAD") {</div><div> return (pass);</div><div> }</div><div> if (req.http.x-forwarded-for) {</div><div> set req.http.X-Forwarded-For = req.http.X-Forwarded-For ", " client.ip;</div><div> }</div><div> else {</div><div> set req.http.X-Forwarded-For = client.ip;</div><div> }</div><div><br></div><div><br></div><div><br></div><div> 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/.*" ) ) {</div><div> lookup;</div><div> }</div><div> else</div><div> {</div><div> pass;</div><div> }</div><div>}</div><div>sub vcl_pipe {</div><div>return (pipe);</div><div>}</div><div>sub vcl_pass {</div><div>return (pass);</div><div>}</div><div><br></div><div><br></div><div>sub vcl_hit{</div><div> set obj.ttl=7d;</div><div>}</div><div>sub vcl_deliver {</div><div> remove resp.http.Via;</div><div> remove resp.http.X-Varnish;</div><div> remove resp.http.server;</div><div> if (obj.hits > 0) {</div><div> set resp.http.X-Cache = "MIC-HIT";</div><div> } else {</div><div> set resp.http.X-Cache = "MIC-MISS";</div><div> }</div><div> return (deliver);</div><div>}</div><div>...</div>----- 原始邮件 -----<br>发件人:Andrea Campi <andrea.campi@zephirworks.com><br>收件人:yangxu4000@sina.com<br>主题:Re: puzzle about unset req.http.cookie<br>日期:2011-6-20 16:47:52<br><br>2011/6/20 <yangxu4000@sina.com>:<br>
> Hello everyone,<br>
> I do not know where to ask my question so I send it here. thanks everyone.<br>
> I hava questions about req.http.cookie:<br>
> I see some configuration on google like this:<br>
> if(req.url ~ ".(js|css|jpg|png|gif|swf|jpeg|ico)$){<br>
> unset req.http.cookie;<br>
> }<br>
> it says if images have cookie,It can not be cached.<br>
> but I do not set this in my configuration, I still saw CACHE-HIT<br>
> (resp.http.X-Cache = "CACHE-HIT") in http response.<br>
> anyone could explain this?<br>
<br>
You probably have something else in your VCL that allows caching.<br>
Send the whole VCL, we can't just guess.<br>
<br>
Andrea<br>