Pipe all remaining requests if URI / condition is met

Hauke Lampe lampe at hauke-lampe.de
Wed Sep 21 21:57:16 CEST 2011


On 21.09.2011 19:24, Kevin wrote:

> I'm curious if its possible to set varnish to pipe all subsequent requests
> (ignoring any rules that say otherwise) if certain specific conditions are
> met (i.e. user visits a login page and is returned to the main page).

With the help of a vmod
(https://github.com/KristianLyng/libvmod-header), you could add a
special cookie to the response and match it early in vcl_recv().

import header;

...
if (req.http.Cookie ~ "(^|; )VCLPIPE=1") {
	return(pipe);
}

...
if (req.url ~ "^/login") {
	header.append(beresp.http.Set-Cookie,"VCLPIPE=1; path=/");
}


Hauke.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20110921/42c2e0b4/attachment-0003.pgp>


More information about the varnish-misc mailing list