Problem with varnish and caching
Manuel Amador (Rudd-O)
rudd-o at rudd-o.com
Wed Jul 4 07:03:30 CEST 2007
Thanks a lot. Will use this to tune Varnish better. This functionality
is not mentioned in the manual page of vcl, nor was it conveyed to me by
Dag-Erling or Poul-Henning.
On mié, 2007-07-04 at 09:37 +0530, Anup Shukla wrote:
> Manuel Amador (Rudd-O) wrote:
> > The optimum behaviour would be Varnish caching static files
> > (img,css,jpg,png, based on response HTTP headers) and not caching
> > dynamic ones. But as it currently stands, Varnish configuration
> > language doesn't allow caching to be controlled based on the response
> > headers, only on the request ones. Squid, however, does.
> >
> >
>
> I had a similar situation.
> In my case the site is 100% php, so in effect anything that comes out
> with Content-Type text/html is php generated and given the nature of the
> site, its not cacheable.
>
> I have also put below my VCL configuration which works fine for me.
> Its not much of a high quality configuration, but works for me.
>
> Suggestion, as always, are welcome :)
>
> sub vcl_recv {
> if (req.request == "GET" && req.http.cookie) {
> lookup;
> }
> }
>
> sub vcl_fetch {
> if (!obj.valid) {
> error;
> }
> if (!obj.cacheable) {
> pass;
> }
> if (resp.http.Content-Type ~ "text/html") {
> pass;
> }
> if (resp.http.Set-Cookie) {
> insert;
> }
> insert;
> }
>
> Hope this helps.
>
> Regards
> A.S
Manuel Amador (Rudd-O) <rudd-o at rudd-o.com>
The R Zone - http://rudd-o.com/
GPG key ID 0xC8D28B92 at http://wwwkeys.pgp.net/
Now playing, courtesy of Amarok: VA - Ingen sommar utan reggae - Markoolio
As flies to wanton boys are we to the gods; they kill us for their sport.
-- Shakespeare, "King Lear"
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20070704/a95d7642/attachment-0002.pgp>
More information about the varnish-misc
mailing list