From 560fdc935c871339f560bae9b3c6d111c9323c47 Mon Sep 17 00:00:00 2001 From: Mattias Geniar Date: Mon, 3 Dec 2012 21:41:22 +0100 Subject: [PATCH] Backends: included a redirector example for multiple backends --- custom.backend.vcl-sample | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/custom.backend.vcl-sample b/custom.backend.vcl-sample index 5e1df9d..3e0a2f7 100644 --- a/custom.backend.vcl-sample +++ b/custom.backend.vcl-sample @@ -13,3 +13,33 @@ backend default { } .first_byte_timeout = 300s; } + +# Below is an example redirector based on the Client IP (same returning class C subnet IP will get +# rerouted to the same backend, as long as it's available). +# +# In order for these to work, you need to define 2 backends as shown above named 'web1' and 'web2' (replace 'default' +# from the example above). +director pool_clientip client { + { + .backend = web1 + .weight = 1; + } + { + .backend = web2 + .weight = 1; + } +} + +# Below is an example that will round-robin (based on the weight) to each backend. +# Web2 will get twice the hits as web1 since it has double the weight (= preference). +director pool_clientip { + { + .backend = web1 + .weight = 1; + } + { + .backend = web2 + .weight = 2; + } +} +