Communication between Varnish and the Backend

Hugues Alary hugues.alary at gmail.com
Fri Mar 16 23:42:33 CET 2012


Hi everybody,

I'm configuring varnish to be used with my web application.

I need my backend to be able to give instructions to Varnish depending on
the page requested. For example, some of my pages contain ESI includes,
some don't.

I want my application to tell varnish wether or not do the esi
processing. This approach allows me to keep my VCL configuration file
abstracted from the application. I can then redistribute the VCL to other
users and let their application control the cache.

So far my solution is to instruct varnish via HTTP headers.

In my current example I set a header X-Application-DoEsi to 1 or 0. When
varnish receives the response from the backend, it looks for the value
of X-Application-DoEsi and does or not the ESI processing.

   - I was wondering if communicating with varnish via HTTP header is a
   good solution?
   - How bad can it be performance wise?
   - Should I be worried about security (interception/modification of the
   communication between Varnish and the backend), even if no credential will
   never be sent through HTTP headers? (Also, currently Varnish and the
   backend are on the same machine, but chances are that they will in the
   future not live on the same host).

In the future, I plan on instructing varnish not to cache certain pages
containing user defined query strings. I want the user to be able to
specify these un-cachable urls query strings directly in the application.
The application will then send the un-cachable query strings in a header
X-Application-QueryStringNoCache: "querystring1,querystring2,...".

Is that a bad idea?

Thank you for your help!

-- 
Hugues ALARY
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20120316/b3fca291/attachment.html>


More information about the varnish-misc mailing list