Caching RESTful Web Services with Varnish

Imran M Yousuf imyousuf at gmail.com
Fri Mar 23 16:05:52 CET 2012


Hi,

I have used Varnish earlier for caching Web Sites and even used ESI
with Varnish. Now I want to use Varnish to cache RESTful Web Services
artifacts. The project I am referring to is as follows:
http://kenai.com/projects/smart-cms/pages/Home

Here is what the Web Service does:
1. Returns Last-Modified, ETag, Cache-Control with max-age
2. Returns 'Vary' as applicable.
3. No session has been used

Here is what I can get to work with out of the box VCL:
1. Caches for the time period mentioned in max-age
2. Does not respond to PUT/POST on the URI being cached

Here is what I want to achieve:
1. I want Varnish to evict from cache if a URI that is cached receives
a POST/PUT/DELETE to it
2. I want Varnish to do conditional GET after cache expires
3. I want to evict all sub-resources of a resource (URI) from cache
upon receiving POST/PUT/DELETE to it

Can someone please guide me to a documentation or sample VCL using
which I can achieve these?

Thank you,

-- 
Imran M Yousuf
Twitter: @imyousuf - http://twitter.com/imyousuf
Blog: http://imyousuf-tech.blogs.smartitengineering.com/
Mobile: +880-1711402557



More information about the varnish-misc mailing list