II'm running into a peculiar problem with Varnish ESI.
Each page on my site has a ESI fragment that spits out the (logged-in) user's account information.
It looks like Varnish is returning the cached result of a user session ESI fragment unless the browser sends a Cache-Control: no-cache / Pragma: no-cache (force refresh) which is when it requests the ESI content from the server.
my vcl_recv contains rules to bypass this:
if(req.url ~ "^/session-header") {
return(pass);
}
vcl_fetch has a rule as well:
if(req.url ~ "^/session-header") {
return(hit_for_pass);
} else {
set beresp.ttl = 1h;
}
Basically, this is the behavior from the browser side:
Cache-Control: max-age=0 => Varnish returns cached ESI fragment
Cache-Control: no-cache / Pragma: no-cache => Varnish fetches ESI fragment from the server
I can't seem to figure it out and I have a feeling I've missed some fairly obvious configuration.