Следующий тестовый пример показывает возможный подход:
varnishtest "..."
server s1 {
rxreq
txresp -hdr "Cache-Control: s-maxage=60"
} -start
varnish v1 -vcl+backend {
sub vcl_miss {
if (!req.http.X-Warm-Cache) {
return (synth(404));
}
}
} -start
client c1 {
txreq -url "/foo" -hdr "X-Warm-Cache: 1"
rxresp
expect resp.status == 200
txreq -url "/foo"
rxresp
expect resp.status == 200
txreq -url "/bar"
rxresp
expect resp.status == 404
} -run