Purging multiple requests
Ken Brownfield
kb+varnish at slide.com
Tue Jan 12 02:44:03 CET 2010
Something like:
sub vcl_recv {
if ( req.request == "GET" ) {
set req.http.OLD-Cookie = req.http.Cookie;
unset req.http.Cookie;
set req.http.OLD-Authorization = req.http.Authorization;
unset req.http.Authorization;
}
}
sub vcl_miss {
if ( req.http.OLD-Cookie ) {
set bereq.http.Cookie = req.http.OLD-Cookie;
unset req.http.OLD-Cookie;
}
if ( req.http.OLD-Authorization ) {
set bereq.http.Authorization = req.http.OLD-Authorization;
unset req.http.OLD-Authorization;
}
}
But beware that you may need to increase your sess_workspace, especially if these headers are large.
--
Ken
On Jan 11, 2010, at 5:27 PM, John Norman wrote:
> 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
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at projects.linpro.no
> http://projects.linpro.no/mailman/listinfo/varnish-misc
More information about the varnish-misc
mailing list