title: How do you set a cookie from within an ESI:include script?
body: <p>I have a basic PHP page being loaded through Varnish with a single ESI include that calls back to the server to set a cookie. The cookie is set with domain access and the like, but when called through ESI the cookie is never set. If you access the ESI include path directly, the cookie is set with no issue. I have even set my Varnish configuration to never cache anything, thinking the VCL could be killing the cookie.</p>
  
  <p>This...</p>
  
  <pre><code>&lt;esi:include src="/init.php?&lt;?=http_build_query($_GET); ?&gt;"&gt;&lt;/esi:include&gt;
  </code></pre>
  
  <p>...includes this...</p>
  
  <pre><code>&lt;?php
  header("Cache-Control: no-cache, must-revalidate");
  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
  
  setcookie('superman', 'clark kent', 0, '/', '.whatever.com');
  
  ?&gt;
  </code></pre>
  
  <p>I'm new with Varnish and ESI, so I'm starting to wonder if this is a known limitation (either with ESI or with Varnish's ESI implementation), but I can't find any discussion of my problem online.</p>