hit-for-pass ignores Vary header

Poul-Henning Kamp phk at phk.freebsd.dk
Mon Jan 5 10:18:16 CET 2015


--------
In message <CAKsTx7AnGoGURk6hQR9om4K6mAQohxQRi+HX0Ya-LqAX0cC2fg at mail.gmail.com>
, Jonathan Matthews writes:

Hi Jonathan,

Sorry about the late reply.  (And happy new year while we're at it :-)

>What I believe is happening is that the resulting hit-for-pass object
>that gets generated and cached seems to ignore the Vary header's
>presence. All subsequent requests for that Host & URI combination get
>hit-for-pass'ed, regardless of the previously valid object sitting in
>the cache for the Host & URI & Vary-header-pointer combination.

I tried this scenario out on -trunk using the varnishtest below and
it does what I expect it to.

We did change something in this particular space recently-ish, so
4.0 may act differently in this corner-case.

Poul-Henning

-------------------------
varnishtest "vary hit-for-pass"

server s1 {
	fatal
	rxreq
	expect req.http.foo == "1"
	txresp -hdr "Vary: foo" -bodylen 1

	rxreq
	expect req.http.foo == "2"
	txresp -status 401 -hdr "Vary: foo" -bodylen 2

	rxreq
	expect req.http.foo == "2"
	txresp -status 402 -hdr "Vary: foo" -bodylen 3
} -start

varnish v1 -vcl+backend {
	sub vcl_hash {
		hash_data(req.http.foo);
	}
} -start

client c1 {
	txreq -hdr "foo: 1"
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 1
	delay .1

	txreq -hdr "foo: 2"
	rxresp
	expect resp.status == 401
	expect resp.bodylen == 2
	delay .1

	txreq -hdr "foo: 2"
	rxresp
	expect resp.status == 402
	expect resp.bodylen == 3
	delay .1

	txreq -hdr "foo: 1"
	rxresp
	expect resp.status == 200
	expect resp.bodylen == 1
	delay .1

} -run

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

-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk at FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe    
Never attribute to malice what can adequately be explained by incompetence.



More information about the varnish-misc mailing list