<div>Hi list</div><div><br></div><div><br></div><div>I love varnish and really want to use it :D Any clue to fix my problem , it come out alot backend fail ( i guess timeout problem )</div><div><br></div><div>my setup</div>
<div><br></div><div>1.Centos 5.3 64bit varnish / webserver</div><div>2.nginx backend server (it run over 200+days 2Mil pv/day without any problem & healthy hardware)</div><div>3.varnish connect to nginx in same internal switchs (3com 5500 Giga layer4)</div>
<div>4.Tested different version nginx was same happen ( nginx-0.6.36 & nginx-0.7.61)</div><div>5.Tested 2 different hardware for varnish same happen</div><div>6.Changed nginx different timeout same happen , if changed to keepalive 0 will more backend fail </div>
<div>7.When i changed vcl to director rr x50 times , it didnt show 503 Service Unavailable on client side but like 2-8 sec. lag when then Backend fail number increase</div><div><br></div><div><br></div><div>#start</div><div>
<br></div><div>varnishd -p lru_interval=3600 -a <a href="http://0.0.0.0:80">0.0.0.0:80</a> -T localhost:3500 -p client_http11=on -f vconf2 -s file,/usr/local/varnish/cache.bin,80G -h classic,500009 -p listen_depth=4096 -p obj_workspace=32768 -p sess_workspace=32768 -p send_timeout=327 -p first_byte_timeout=300 -p connect_timeout=5 -p vcl_trace=on</div>
<div><br></div><div><br></div><div><br></div><div>#varnishlog </div><div><br></div><div> 140 ReqStart c 121.203.78.124 4755 1383283991</div><div> 140 RxRequest c GET</div><div> 140 RxURL c /thread-1131553-1-1.html</div>
<div> 140 RxProtocol c HTTP/1.1</div><div> 140 RxHeader c Host: <a href="http://www.zoobar.com">www.zoobar.com</a></div><div> 140 RxHeader c User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-TW; rv:1.9.0.14) Gecko/2009082707 Firefox/3.0.14</div>
<div> 140 RxHeader c Accept: image/png,image/*;q=0.8,*/*;q=0.5</div><div> 140 RxHeader c Accept-Language: zh-tw,en-us;q=0.7,en;q=0.3</div><div> 140 RxHeader c Accept-Encoding: gzip,deflate</div><div> 140 RxHeader c Accept-Charset: Big5,utf-8;q=0.7,*;q=0.7</div>
<div> 140 RxHeader c Keep-Alive: 300</div><div> 140 RxHeader c Connection: keep-alive</div><div> 140 RxHeader c Referer: <a href="http://www.zoobar.com/thread-1131553-1-1.html">http://www.zoobar.com/thread-1131553-1-1.html</a></div>
<div> 140 RxHeader c Cookie: cdb_sid=Nf6FM3; cdb_oldtopics=D1131553D1131773D1129353D1129581D1130425D1131274D1121699D1122534D1122581D1124932D1125704D1126044D1126641D1126650D1127247D1128227D1128288D1128329D1128640D1129165D1129403D1130965D1131013D1131057D1131460D1131464D1131491D</div>
<div> 140 VCL_call c recv</div><div> 140 VCL_trace c 1 106.14</div><div> 140 VCL_trace c 2 110.5</div><div> 140 VCL_trace c 3 110.41</div><div> 140 VCL_trace c 9 143.5</div><div> 140 VCL_trace c 14 157.1</div>
<div> 140 VCL_trace c 15 157.5</div><div> 140 VCL_trace c 17 162.1</div><div> 140 VCL_trace c 18 162.5</div><div> 140 VCL_trace c 26 172.9</div><div> 140 VCL_trace c 27 172.13</div><div> 140 VCL_trace c 30 180.1</div>
<div> 140 VCL_trace c 31 180.5</div><div> 140 VCL_trace c 33 184.1</div><div> 140 VCL_trace c 34 184.5</div><div> 140 VCL_trace c 36 192.1</div><div> 140 VCL_trace c 37 192.5</div><div> 140 VCL_trace c 39 198.1</div>
<div> 140 VCL_trace c 40 198.5</div><div> 140 VCL_trace c 41 198.31</div><div> 140 VCL_trace c 42 199.9</div><div> 140 VCL_trace c 44 202.18</div><div> 140 VCL_trace c 45 202.53</div><div> 140 VCL_trace c 49 213.1</div>
<div> 140 VCL_trace c 84 42.14</div><div> 140 VCL_trace c 85 43.9</div><div> 140 VCL_trace c 93 53.5</div><div> 140 VCL_trace c 94 53.9</div><div> 140 VCL_trace c 97 57.5</div><div> 140 VCL_trace c 98 57.9</div>
<div> 140 VCL_trace c 99 57.35</div><div> 140 VCL_trace c 100 57.52</div><div> 140 VCL_return c pass</div><div> 140 VCL_call c pass</div><div> 140 VCL_trace c 103 74.14</div><div> 140 VCL_return c pass</div>
<div> 140 VCL_call c error</div><div> 140 VCL_trace c 124 129.15</div><div> 140 VCL_return c deliver</div><div> 140 Length c 466</div><div> 140 VCL_call c deliver</div><div> 140 VCL_trace c 69 327.17</div>
<div> 140 VCL_trace c 70 328.21</div><div> 140 VCL_trace c 75 344.1</div><div> 140 VCL_trace c 120 110.17</div><div> 140 VCL_return c deliver</div><div> 140 TxProtocol c HTTP/1.1</div><div> 140 TxStatus c 503</div>
<div> 140 TxResponse c Service Unavailable</div><div> 140 TxHeader c Server: Varnish</div><div> 140 TxHeader c Retry-After: 0</div><div> 140 TxHeader c Content-Type: text/html; charset=utf-8</div><div> 140 TxHeader c Content-Length: 466</div>
<div> 140 TxHeader c Date: Tue, 22 Sep 2009 16:15:52 GMT</div><div> 140 TxHeader c X-Varnish: 1383283991</div><div> 140 TxHeader c Age: 0</div><div> 140 TxHeader c Via: 1.1 varnish</div><div> 140 TxHeader c Connection: close</div>
<div> 140 ReqEnd c 1383283991 1253636152.715658903 1253636152.715944052 0.016985893 0.000265121 0.000020027</div><div> 140 SessionClose c error</div><div> 140 StatSess c 121.203.78.124 4755 0 1 1 0 1 0 235 466</div>
<div> </div><div> </div><div> </div><div> </div><div> #varnishstat -1 </div><div><br></div><div>uptime 266 . Child uptime</div><div>client_conn 13993 52.61 Client connections accepted</div>
<div>client_req 43378 163.08 Client requests received</div><div>cache_hit 31219 117.36 Cache hits</div><div>cache_hitpass 86 0.32 Cache hits for pass</div><div>cache_miss 3523 13.24 Cache misses</div>
<div>backend_conn 12054 45.32 Backend connections success</div><div>backend_unhealthy 0 0.00 Backend connections not attempted</div><div>backend_busy 0 0.00 Backend connections too many</div>
<div>backend_fail 5900 22.18 Backend connections failures</div><div>backend_reuse 3503 13.17 Backend connections reuses</div><div>backend_recycle 11552 43.43 Backend connections recycles</div>
<div>backend_unused 0 0.00 Backend connections unused</div><div>n_srcaddr 1246 . N struct srcaddr</div><div>n_srcaddr_act 64 . N active struct srcaddr</div>
<div>n_sess_mem 974 . N struct sess_mem</div><div>n_sess 84 . N struct sess</div><div>n_object 3040 . N struct object</div><div>n_objecthead 1972 . N struct objecthead</div>
<div>n_smf 6460 . N struct smf</div><div>n_smf_frag 573 . N small free smf</div><div>n_smf_large 7 . N large free smf</div><div>n_vbe_conn 119 . N struct vbe_conn</div>
<div>n_bereq 240 . N struct bereq</div><div>n_wrk 261 . N worker threads</div><div>n_wrk_create 261 0.98 N worker threads created</div><div>
n_wrk_failed 0 0.00 N worker threads not created</div><div>n_wrk_max 336496 1265.02 N worker threads limited</div><div>n_wrk_queue 0 0.00 N queued work requests</div>
<div>n_wrk_overflow 4696 17.65 N overflowed work requests</div><div>n_wrk_drop 374 1.41 N dropped work requests</div><div>n_backend 60 . N backends</div>
<div>n_expired 675 . N expired objects</div><div>n_lru_nuked 0 . N LRU nuked objects</div><div>n_lru_saved 0 . N LRU saved objects</div><div>
n_lru_moved 0 . N LRU moved objects</div><div>n_deathrow 0 . N objects on deathrow</div><div>losthdr 0 0.00 HTTP header overflows</div><div>
n_objsendfile 0 0.00 Objects sent with sendfile</div><div>n_objwrite 41590 156.35 Objects sent with write</div><div>n_objoverflow 0 0.00 Objects overflowing workspace</div>
<div>s_sess 10425 39.19 Total Sessions</div><div>s_req 43325 162.88 Total Requests</div><div>s_pipe 0 0.00 Total pipe</div><div>s_pass 8542 32.11 Total pass</div>
<div>s_fetch 11996 45.10 Total fetch</div><div>s_hdrbytes 16332373 61399.90 Total header bytes</div><div>s_bodybytes 266640005 1002406.03 Total body bytes</div><div>sess_closed 2116 7.95 Session Closed</div>
<div>sess_pipeline 54 0.20 Session Pipeline</div><div>sess_readahead 34 0.13 Session Read Ahead</div><div>sess_linger 0 0.00 Session Linger</div><div>sess_herd 41284 155.20 Session herd</div>
<div>shm_records 3806411 14309.82 SHM records</div><div>shm_writes 134677 506.30 SHM writes</div><div>shm_flushes 40 0.15 SHM flushes due to overflow</div><div>shm_cont 884 3.32 SHM MTX contention</div>
<div>shm_cycles 1 0.00 SHM cycles through buffer</div><div>sm_nreq 24335 91.48 allocator requests</div><div>sm_nobj 5880 . outstanding allocations</div>
<div>sm_balloc 129392640 . bytes allocated</div><div>sm_bfree 85769953280 . bytes free</div><div>sma_nreq 0 0.00 SMA allocator requests</div><div>sma_nobj 0 . SMA outstanding allocations</div>
<div>sma_nbytes 0 . SMA outstanding bytes</div><div>sma_balloc 0 . SMA bytes allocated</div><div>sma_bfree 0 . SMA bytes free</div><div>
sms_nreq 111 0.42 SMS allocator requests</div><div>sms_nobj 0 . SMS outstanding allocations</div><div>sms_nbytes 0 . SMS outstanding bytes</div>
<div>sms_balloc 50376 . SMS bytes allocated</div><div>sms_bfree 50376 . SMS bytes freed</div><div>backend_req 12054 45.32 Backend requests made</div><div>
n_vcl 1 0.00 N vcl total</div><div>n_vcl_avail 1 0.00 N vcl available</div><div>n_vcl_discard 0 0.00 N vcl discarded</div><div>n_purge 1 . N total active purges</div>
<div>n_purge_add 1 0.00 N new purges added</div><div>n_purge_retire 0 0.00 N old purges deleted</div><div>n_purge_obj_test 0 0.00 N objects tested</div><div>
n_purge_re_test 0 0.00 N regexps tested against</div><div>n_purge_dups 0 0.00 N duplicate purges removed</div><div>hcb_nolock 0 0.00 HCB Lookups without lock</div>
<div>hcb_lock 0 0.00 HCB Lookups with lock</div><div>hcb_insert 0 0.00 HCB Inserts</div><div>esi_parse 0 0.00 Objects ESI parsed (unlock)</div>
<div>esi_errors 0 0.00 ESI parse errors (unlock)</div><div><br></div><div><br></div><div># my vcl </div><div><br></div><div>director srv1 round-robin {</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div>
<div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div>
{ .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> { .backend = { .connect_timeout = 2s; .host = "10.0.0.5"; .port = "80"; } }</div><div> }</div>
<div><br></div><div><br></div><div>acl purge {</div><div><br></div><div> "localhost"; "127.0.0.1";</div><div>}</div><div><br></div><div>#recv</div><div>sub vcl_recv {</div><div><br></div><div>#set req.grace = 30s;</div>
<div><br></div><div>if (req.http.host ~ "<a href="http://www.zoobar.com">www.zoobar.com</a>") {</div><div> set req.http.host = "<a href="http://www.zoobar.com">www.zoobar.com</a>";</div><div> set req.backend = srv1;</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> </div><div> </div><div>}elseif ( req.http.host ~ "<a href="http://www.voobar.com">www.voobar.com</a>") {</div><div> set req.http.host = "<a href="http://www.voobar.com">www.voobar.com</a>";</div>
<div> set req.backend = srv1;</div><div> </div><div><br></div><div>}elseif ( req.http.host ~ "<a href="http://www.hoobar.com">www.hoobar.com</a>") {</div><div> set req.http.host = "<a href="http://www.hoobar.com">www.hoobar.com</a>"; </div>
<div> set req.backend = srv1;</div><div> </div><div>}else{</div><div> error 401 "Bad Domain";</div><div>} </div><div><br></div><div># Add a unique header containing the client address</div><div>remove req.http.X-Forwarded-For;</div>
<div>set req.http.X-Forwarded-For = client.ip;</div><div># [...]</div><div><br></div><div><br></div><div>if (req.request == "PURGE") {</div><div> if(!client.ip ~ purge) {</div><div> error 405 "Not Allowed";</div>
<div> } lookup;}</div><div><br></div><div>if (req.http.Expect) {</div><div> pipe;</div><div> }</div><div><br></div><div><br></div><div>if (req.request != "GET" &&</div><div> req.request != "HEAD" &&</div>
<div> req.request != "PUT" &&</div><div> req.request != "POST" &&</div><div> req.request != "TRACE" &&</div><div> req.request != "OPTIONS" &&</div>
<div> req.request != "DELETE") {</div><div> /* Non-RFC2616 or CONNECT which is weird. */</div><div> pipe;</div><div> }</div><div> if (req.request != "GET" && req.request != "HEAD") {</div>
<div> /* We only deal with GET and HEAD by default */</div><div> pass;</div><div> }</div><div><br></div><div><br></div><div><br></div><div><br></div><div>if (req.http.Cache-Control ~ "no-cache") {</div>
<div> pass;</div><div> } </div><div><br></div><div>if (req.http.Authenticate) {</div><div> pass;</div><div> }</div><div><br></div><div>#if (req.http.Cookie) {</div><div># pass;</div><div># }</div><div><br>
</div><div>if (req.url ~ "\.(zip|ico|dat|torrent|png|gif|jpg|swf|css|js|bmp|bz2|tbz|mp3|ogg)$") {</div><div> unset req.http.cookie;</div><div> lookup;</div><div># unset req.http.authenticate;</div><div>
}</div><div><br></div><div>if (req.http.Accept-Encoding) {</div><div> if (req.url ~ "\.(zip|ico|dat|torrent|png|gif|jpg|swf|css|js|bmp|bz2|tbz|mp3|ogg)$") {</div><div> # No point in compressing these</div>
<div> remove req.http.Accept-Encoding;</div><div> } elsif (req.http.Accept-Encoding ~ "gzip") {</div><div> set req.http.Accept-Encoding = "gzip";</div><div> } elsif (req.http.Accept-Encoding ~ "deflate") {</div>
<div> set req.http.Accept-Encoding = "deflate";</div><div> } else {</div><div> # unkown algorithm</div><div> remove req.http.Accept-Encoding;</div><div> }</div><div>
}</div><div><br></div><div><br></div><div>} #end recv</div><div><br></div><div><br></div><div>sub vcl_hash {</div><div>set req.hash += req.url;</div><div>set req.hash += req.http.host;</div><div>#set req.hash += req.http.cookie;</div>
<div>#set req.hash += server.ip;</div><div>hash;</div><div>} #end hash</div><div><br></div><div><br></div><div># strip the cookie before the image is inserted into cache.</div><div>sub vcl_fetch {</div><div><br></div><div>
#set obj.grace = 30s;</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if(obj.http.Set-Cookie){</div><div> pass;</div><div> }</div><div><br>
</div><div><br></div><div> if(obj.http.Pragma ~ "no-cache" || </div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>obj.http.Cache-Control ~ "no-cache" || </div><div><span class="Apple-tab-span" style="white-space:pre"> </span> obj.http.Cache-Control ~ "private"){</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> pass;</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>if (req.url ~ "\.(zip|ico|dat|torrent|png|gif|jpg|swf|css|js|bmp|bz2|tbz|mp3|ogg)$") {</div>
<div> unset obj.http.set-cookie;</div><div> set obj.ttl = 1w;</div><div> }</div><div><br></div><div><br></div><div><br></div><div><br></div><div>if (req.url ~ "\.(zip|ico|dat|torrent|png|gif|jpg|swf|css|js|bmp|bz2|tbz|mp3|ogg)$") {</div>
<div>unset obj.http.expires;</div><div>set obj.http.cache-control = "max-age=315360000, public";</div><div>set obj.ttl = 1w;</div><div>set obj.http.magicmarker = "1";</div><div>}</div><div><br></div><div>
<br></div><div> if (obj.status == 503) {</div><div><br></div><div> restart;</div><div> }</div><div><br></div><div><br></div><div>#<span class="Apple-tab-span" style="white-space:pre"> </span>if (obj.cacheable) {</div>
<div># /* Remove Expires from backend, it's not long enough */</div><div># unset obj.http.expires;</div><div><br></div><div># /* Set the clients TTL on this object */</div>
<div># set obj.http.cache-control = "max-age=315360000, public";</div><div><br></div><div># /* Set how long Varnish will keep it */</div><div># set obj.ttl = 1w;</div>
<div><br></div><div># /* marker for vcl_deliver to reset Age: */</div><div># set obj.http.magicmarker = "1";</div><div># }</div><div><br></div><div><br>
</div><div> } #fetch end</div><div><br></div><div><br></div><div><br></div><div><br></div><div>sub vcl_deliver {</div><div> if (resp.http.magicmarker) {</div><div> /* Remove the magic marker */</div>
<div> unset resp.http.magicmarker;</div><div><br></div><div> /* By definition we have a fresh object */</div><div> set resp.http.age = "0";</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span>if (obj.hits > 0) {</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>set resp.http.X-Cache = "HIT";</div>
<div><span class="Apple-tab-span" style="white-space:pre"> </span> } else {</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span>set resp.http.X-Cache = "MISS";</div><div>
<span class="Apple-tab-span" style="white-space:pre"> </span>}</div><div><br></div><div> }</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><br></div><div><br></div>
<div>} #deliver end</div><div><br></div><div><br></div><div>sub vcl_pipe {</div><div> # <a href="http://varnish.projects.linpro.no/ticket/451">http://varnish.projects.linpro.no/ticket/451</a></div><div> # This forces every pipe request to be the first one.</div>
<div> set bereq.http.connection = "close";</div><div>} #pipe end</div><div><br></div><div><br></div><div>sub vcl_hit {</div><div> if (req.request == "PURGE") {</div><div> set obj.ttl = 0s;</div>
<div> error 200 "Purged.";</div><div> }</div><div><br></div><div> if (!obj.cacheable) {</div><div> pass;</div><div> }</div><div> deliver;</div><div>
}</div><div><br></div><div><br></div><div><br></div><div><br></div><div>Thank you </div><div><br></div><div>TW</div>