How to set up Authcache module with Varnish and ESI?
When using this file I had to scroll down to line 142 and change this:

  if (req.restarts == 0 &amp;&amp; server.identity !~ "^/tmp/vtc.") {
    unset req.http.X-Authcache-Do-ESI;
    unset req.http.X-Authcache-Get-Key;
    unset req.http.X-Authcache-Key-CID;
    unset req.http.X-Authcache-Key;
  }


into this:

  if (req.restarts == 0 &amp;&amp; server.identity !~ "^/tmp/vtc.") {
    unset req.http.X-Authcache-Do-ESI;
    unset req.http.X-Authcache-Get-Key;
    unset req.http.X-Authcache-Key-CID;
    unset req.http.X-Authcache-Key;
  }

  set req.http.X-Authcache = 1; // Added by me
  set req.http.X-Authcache-Do-ESI = 1; // Added by me


I'm not sure why those headers are not added but instead removed in the default version, since the module seems to require them to be present in the first incoming request. However, given the nature of those headers, they seem to make more sense when returned from the backend to Varnish than the opposite. znerol might have a good answer for you (and for me) why they are required in the first request.

I also wanna say thank you znerol for this amazing module and for the ongoing documentation work.