Varnish - set backend if statuscode is 404

Tobias Honacker t.honacker at
Wed Nov 27 11:35:22 CET 2013

Hey guys,

i’ve got one problem and don’t know how to solve this problem.
I have to use another backend if the req.url matches AND HTTP Status is 404.

sub vcl_recv {
if (req.url ~ „^/path/to/images") {
 set req.backend = p1_backend;
 set = "“;

How to solve the 404 Status?

varnishd -V
varnishd (varnish-3.0.2 revision 55e70a4)
Copyright (c) 2006 Verdens Gang AS
Copyright (c) 2006-2011 Varnish Software AS

Thanks for any information.

Best regards,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list