if obj.status == 50[1|2|3|x] -> reissue request on next backend(s)

Poul-Henning Kamp phk at phk.freebsd.dk
Tue Sep 1 11:48:25 CEST 2009


In message <1251797169.13050.48.camel at pioneer>, Gerald Leier writes:
>hello again,
>
>Is or isnt it possible to make varnish ask another backend
>if the first returns a HTTP 500 or any other user defined
>HTTP code when forwarding a users request?
>
>and if its possible -> whats the varnish way to do that?

Use the "restart" facility, which basically tried the request
once more from the beginning, with any possible modifications
you have made or will make.

Typically, you would set another backend in vcl_recv{},
something like:

	...
	if (req.restarts > 0) {
		set req.backend = better_one;
	} else {
		set req.backend = normal_one
	}


-- 
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