Change backend when pass
thierry.magnien at sfr.com
Thu Dec 15 17:29:29 CET 2011
I have a setup where I don't manage objects' TTL because the origin server is handled by someone else. To setup correct caching options, I use an nginx server as reverse proxy.
So, my setup is :
Client -> varnish -> nginx -> origin server
The nginx fixes the TTL options so that varnish just has to respect what the backend tells him.
The problem with this setup is the following : for uncacheable objects, I have an extra step (nginx) that I would like to avoid.
I would like to setup something like this:
- in vcl_recv I select nginx as my default backend
- if the object is non-cacheable, return hit_for_pass
- in vcl_pass, set backend to point to the origin server.
So each time I get a hit_for_pass, all subsequent requests for the object will go directly to the origin server and not through the nginx.
Does this sound good to you or am I completely mistaken ?
More information about the varnish-misc