Re: Caching issue
Shain Miley [EMAIL PROTECTED] writes: Here is the output from an original request...nothing is cached at this point..I hope it has the backend info you need. Well, I don't need anything since I've already found the problem :) But yes, the backend information is there (lines that have 'b' instead of 'c' in the third column) DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
Re: Caching issue
Is this FAQ fodder ? In message [EMAIL PROTECTED], =?utf-8?Q?Dag-Erling_Sm=C3=B8rgrav?= writes: Poul-Henning Kamp [EMAIL PROTECTED] writes: You could try the following in vcl_recv: if (req.http.accept-encoding) { set req.http.accept-encoding =3D regsub( req.http.accept-encoding, gzip, *, gzip,); } to get rid of the space(s), but it is not guaranteed to get all cases. Alternatively, the more brutal: if (req.http.accept-encoding ~ gzip) { set req.http.accept-encoding =3D gzip; } else { unset req.http.accept-encoding; } Will get the desired effect in all cases, provided your backend does not attempt deflate as fallback. A slightly more complex solution, to cover all bases without losing functionality: set req.http.accept-encoding =3D regsub(req.http.accept-encoding, ^ *gzip, *deflate *$, gzip,deflate); set req.http.accept-encoding =3D regsub(req.http.accept-encoding, ^ *deflate, *gzip *$, gzip,deflate); This should take care of 99% of cases; I don't know of any browser that supports only one of the two, or supports anything *but* those two. However, Apache only supports gzip, so Poul-Henning's solution is sufficient in this case. DES --=20 Dag-Erling Sm=C3=B8rgrav Senior Software Developer Linpro AS - www.linpro.no -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 [EMAIL PROTECTED] | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence. ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
Re: Caching issue
Poul-Henning Kamp [EMAIL PROTECTED] writes: Is this FAQ fodder ? Yes, I'll stick it in the wiki. DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
Re: Caching issue
Shain Miley [EMAIL PROTECTED] writes: The output from below is a result of 'varnishlog log.file'. According to the man page if I don't use '-b' or '-c' both are assumed. Best practice for Varnish logging is to store the raw log data in a file which can later be read back by varnishlog and varnishncsa. I don't know why any of the logging would be missing? Am I missing somthing? The backend traffic is missing; I can't tell why since I don't know precisely what you did. In terms of the 'different Accept-Encoding header ' being set by the other browser..do you mean the 'Vary' header? No. The client sends Accept-*, the server sends Vary. The Vary header tells Varnish which of the Accept-* headers are relevant. The reason I ask is because both set Accept-Encoding to 'gzip:deflate' so they are the same there. No, they aren't. Look closer. If it is the result of 'Vary' can I simply remove that header and achive what I am looking for? Not unless you also strip any incoming Accept* headers. I would also like to know if anyone knows how I can better debug the hash that is being created...ie...I would like you know exaclty what information is being used in it's creation, so I can get to a plcae really where only the url is being used as the hash... The way your vcl_hash is set up only the URL is being used in the hash. Vary support cannot be implemented correctly by just including it in the hash string, so it isn't. DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
Re: Caching issue
Adrian Otto [EMAIL PROTECTED] writes: I can't say for certain without looking at it myself, but I wonder if when you request the URL from the second machine using firefox you are actually doing a refresh that's setting a Cache-Control header that's forcing varnish to consult the origin server. For the millionth time, Varnish *intentionally* *does* *not* *obey* these headers. DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
RE: Caching issue
; hash; } Thanks, Shain -Original Message- From: Dag-Erling Smørgrav [mailto:[EMAIL PROTECTED] Sent: Sat 3/8/2008 10:58 AM To: Shain Miley Cc: Adrian Otto; varnish-dev@projects.linpro.no Subject: Re: Caching issue Shain Miley [EMAIL PROTECTED] writes: Thanks for the info...here is the output from my request (ip's changed)..in case this can shed some light on things: This is useless if you don't also show us a request that worked. DES -- Dag-Erling Smørgrav Senior Software Developer Linpro AS - www.linpro.no ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
Re: Caching issue
Adrian, Thanks for the info...here is the output from my request (ip's changed)..in case this can shed some light on things: 0 CLIRd ping 0 CLIWr 0 200 PONG 1204928472 0 WorkThread 0x66b1d1b0 start 12 SessionOpen c 172.1.1.1 3690 0 WorkThread 0x6531d1b0 end 12 ReqStart c 172.1.1.1 3690 84896454 12 RxRequestc GET 12 RxURLc /index.html 12 RxProtocol c HTTP/1.1 12 RxHeader c Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */* 12 RxHeader c Accept-Language: en-us 12 RxHeader c UA-CPU: x86 12 RxHeader c Accept-Encoding: gzip, deflate 12 RxHeader c User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.2; .NET CLR 1.1.4322; .NET CLR 2.0.50727) 12 RxHeader c Host: host.xxx.com:8080 12 RxHeader c Connection: Keep-Alive 12 RxHeader c Cookie: v1st=9771DC737ED120FD; GUID=000CD0009ECB070B15D1037761626364 12 VCL_call c recv 12 VCL_return c lookup 12 VCL_call c hash 12 VCL_return c hash 12 VCL_call c miss 12 VCL_return c fetch 12 Length c 455 12 VCL_call c deliver 12 VCL_return c deliver 12 TxProtocol c HTTP/1.1 12 TxStatus c 503 12 TxResponse c Service Unavailable 12 TxHeader c Server: Varnish 12 TxHeader c Retry-After: 30 12 TxHeader c Content-Type: text/html; charset=utf-8 12 TxHeader c Content-Length: 455 12 TxHeader c Date: Fri, 07 Mar 2008 22:21:14 GMT 12 TxHeader c X-Varnish: 84896454 12 TxHeader c Age: 0 12 TxHeader c Via: 1.1 varnish 12 TxHeader c Connection: keep-alive 12 ReqEnd c 84896454 1204928473.923037052 1204928474.937938929 0.004235029 1.014863968 0.37909 0 StatAddr 172.1.1.1 0 5172 23 249 0 0 11 63867 204568 0 CLIRd ping 0 CLIWr 0 200 PONG 1204928475 Shain Adrian Otto wrote: Shain, I can't say for certain without looking at it myself, but I wonder if when you request the URL from the second machine using firefox you are actually doing a refresh that's setting a Cache-Control header that's forcing varnish to consult the origin server. I suggest connecting to your varnish with varnishlog and watching the headers that each client sends varnish. If you see headers like this: 13 RxHeader c Pragma: no-cache 13 RxHeader c Cache-Control: no-cache Then you know that's what's happening. In general, it sounds like you are looking for an off-line mode where the cache server simply serves stale content if an origin server can not be reached. If that feature is present in varnish, I'm not aware of it. Adrian On Mar 7, 2008, at 1:10 PM, Shain Miley wrote: Hello all, First let me say thanks to everyone for taking time to work on this project...I am still in the testing phase, however if all goes well Varnish is going to come in quite handy. So here is my problem: I would like to use varnish to cache urls for say a period of 30 minutes. The caching seems fine as long as I use the same browser to request the url. But I am looking for a stop gap solution at this time so in the event that the web server becomes unavailablevarnish can serve the docs for a little while, so we can get things back in order. Anyway..as it stands right now..I can request a url from wget or GET or firefox... and turn off the webserver and I can refresh the page and all is well. What I cannot do...is request a url using GET on one machine..then stop the webserver and request that same url from firefox (different machine) and get a valid page...I get a 503 error...Here is the vcl.conf file (which I took most of from the web) I am using: Any help would be great! Thanks, Shain sub vcl_recv { if (req.request != GET req.request != HEAD) { # PURGE request if zope asks nicely if (req.request == PURGE) { if (!client.ip ~ purge) { error 405 Not allowed.; } lookup; } pipe; } if (req.http.Expect) { pipe; } if (req.http.Authenticate || req.http.Authorization) { pass; } # We only care about the __ac.* cookies, used for authentication if (req.http.Cookie req.http.Cookie ~ __ac(|_(name|password|persistent))=) { pass; } # File type that we will always cache if (req.request == GET req.url ~ \.(html|php|gif|jpg|swf|css|js|png|jpg|jpeg|gif|png|tiff|tif|svg|swf|ico|css|js|vsd|doc|ppt|pps|xls|pdf|mp3|mp4|m4a|ogg|mov|avi|wmv|sxw|zip|gz|bz2|tgz|tar)$) { lookup; } if (req.request ==