Purging multiple requests

John Norman john at 7fff.com
Tue Jan 12 02:27:40 CET 2010


Scenario:

-- We would prefer not to leverage checking a lot of paths.

-- Many pages are cached for GET's.

-- In vcl_recv, we want to remove cookies and check the cache:

if (req.request == "GET") {
     unset req.http.cookie;
     unset req.http.Authorization;
     lookup;
 }

BUT: Suppose the lookup results in a MISS:

Now we would like to "pass" but WITH the cookies. I.e., check the
cache without cookies; but if there's a miss, reattach them and make
the request.

----------------------

Let me put this another way, describing what's happening in our code:

There are many routine server responses for which we have set caching
headers. All is beautiful.

But we have some, primarily of the form

    /something/edit

where we would like to use the cookie to bring data into a form.

To be sure, we could check the file paths . . .

if (req.request == "GET" && req.url !~ "/edit$") {
     unset req.http.cookie;
     unset req.http.Authorization;
     lookup;
 }

but we were wondering if there is a pattern to save the cookies and
then reattach them later (in vcl_miss??), and thus get the "pass" to
the backend with the cookies back on the request.

John



More information about the varnish-misc mailing list