I'm using Varnish 3 for caching responses from a web application that uses Edge Side Includes (ESI).
There are generally two types of responses from ESI endpoints:
- some are authentication-specific, responses thus use
Vary: Cookie, Accept-Encoding
- some be cached for all users regardless of cookies, thus responding with
Vary: Accept-Encoding
(without varying by cookie)
All requests do contain a Cookie
header with various cookies. Requests with no Cookie
header are responded to with Set-Cookie
. Note that this is not the case of __
-prefixed cookies from e.g. Google Analytics - these are cookies set by a legacy application, and I have no means to change this behavior.
Is there a way* to configure Varnish 3 to remember that responses from respective ESI endpoints do not vary by cookie, thus future requests should ignore the Cookie
header altogether and use a cached response instead of fetching a new one from the backend?
(*) other than hardcoding URIs into Varnish config, i.e. I'm looking for a way for Varnish to respect cookie-less Vary
header for requests that do contain cookies.