> Is there an easy vcl trick to get varnish to always pass php requests to > the > webserver and to cache images, css javascript, etc? > > I would like > > apache->varnish->client > > If the client requests a document, the php is run on the webserver, > varnish > takes it and downloads it to the client so that the apache thread can be > used for other things. Varnish can cache the images and text files as they > don't change. > > Thoughts?
Hi Jack, This seems straightforward, in vcl_recv you would need something like: sub vcl_recv { if (req.url ~ "\.(ico|gif|jpeg|jpg|png|swf|css|htc|js|bz2|gz|zip|xls|ppt|pdf|doc|rar)") { lookup; } pass; } The idea is that items that you 'know' are cacheable get looked up in the cache and fetched from the backend if necessary, and that everything else otherwise gets passed straight to the backend for servicing. (note that this is an extremely abbreviated example that probably omits several important considerations like cookies, etc. Including, depending on what headers, etc the backend emits, you may want some more code in vcl_fetch to decide whether something is insert-ed into the cache or pass-ed onwards) Hope this helps, regards, Darryl Dixon Winterhouse Consulting Ltd http://www.winterhouseconsulting.com _______________________________________________ varnish-misc mailing list varnish-misc@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-misc