Passing variable data to ESI requests
Raul.Rangel at disney.com
Thu Nov 8 16:38:47 CET 2012
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.
set req.http.X-Cookie-One = regsub(req.http.Cookie,"^.*?mycookie=([^;]*);*.*$" , "\1");
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.
From: varnish-dev-bounces at varnish-cache.org [mailto:varnish-dev-bounces at varnish-cache.org] On Behalf Of Guilhaume Bordiau
Sent: Thursday, November 08, 2012 3:42 AM
To: varnish-dev at varnish-cache.org
Subject: Passing variable data to ESI requests
We're using Varnish since a few weeks but are facing the issue of using dynamic content inside cached pages.
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.
So we're starting to think of developing the missing part of code in Varnish that could make it do what we need:
Allow to pass the original request headers and cookies to the ESI URI contained in a cached page.
So my questions are:
- Can you confirm that's it's currently not possible?
- What would be the amount of work to achieve this?
- Any tips to help me getting started with this?
Much thanks in advance to all.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the varnish-dev