<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=utf-8"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Guilhaume,<o:p></o:p></p><p class=MsoNormal>There are a few tricks you can use to do this. First of all you can extract the cookie that you are interested in and place it in a header.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>vcl_recv {<o:p></o:p></p><p class=MsoNormal> set req.http.X-Cookie-One = regsub(req.http.Cookie,"^.*?mycookie=([^;]*);*.*$" , "\1");<o:p></o:p></p><p class=MsoNormal> unset req.http.Cookie;<o:p></o:p></p><p class=MsoNormal>}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Then when varnish does the request to the parent page you can completely ignore the X-Cookie-One header. As for the subsequent ESI requests they too should also have the X-Cookie-One header attached to them. In your back end you should be able to read the header and in the response include a Very: X-Cookie-One. This way you get per user caching on the ESI.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Raul<span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> varnish-dev-bounces@varnish-cache.org [mailto:varnish-dev-bounces@varnish-cache.org] <b>On Behalf Of </b>Guilhaume Bordiau<br><b>Sent:</b> Thursday, November 08, 2012 3:42 AM<br><b>To:</b> varnish-dev@varnish-cache.org<br><b>Subject:</b> Passing variable data to ESI requests<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Hello,<o:p></o:p></p><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>We're using Varnish since a few weeks but are facing the issue of using dynamic content inside cached pages.<o:p></o:p></p></div><div><p class=MsoNormal>We tried ESI for that but it appears that there's no way to pass some (or all) of the original request elements (headers, cookies) to the ESI request made toward our server.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>We implemented hacks through cookies read from javascript, triggering ajax requests, but we're facing maintainability issues around browsers refusing cookies (our app run in an iframe and domains are different from the top frame).<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>So we're starting to think of developing the missing part of code in Varnish that could make it do what we need: <o:p></o:p></p></div><div><p class=MsoNormal>Allow to pass the original request headers and cookies to the ESI URI contained in a cached page.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>So my questions are:<o:p></o:p></p></div><div><p class=MsoNormal>- Can you confirm that's it's currently not possible?<o:p></o:p></p></div><div><p class=MsoNormal>- What would be the amount of work to achieve this?<o:p></o:p></p></div><div><p class=MsoNormal>- Any tips to help me getting started with this?<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Much thanks in advance to all.<o:p></o:p></p></div><div><p class=MsoNormal><o:p> </o:p></p></div><div><p class=MsoNormal>Guilhaume Bordiau.<o:p></o:p></p></div></div></body></html>