Permalink
Browse files

Backends: included a redirector example for multiple backends

  • Loading branch information...
1 parent 16b3df5 commit 560fdc935c871339f560bae9b3c6d111c9323c47 @mattiasgeniar committed Dec 3, 2012
Showing with 30 additions and 0 deletions.
  1. +30 −0 custom.backend.vcl-sample
View
@@ -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;
+ }
+}
+

0 comments on commit 560fdc9

Please sign in to comment.