Skip to content

Instantly share code, notes, and snippets.

@lkarsten
Created September 21, 2015 12:35
Show Gist options
  • Save lkarsten/9e5f7e40972a1c9c568a to your computer and use it in GitHub Desktop.
Save lkarsten/9e5f7e40972a1c9c568a to your computer and use it in GitHub Desktop.
vcl 4.0;
import std;
import directors;
backend a1 { .host = "192.0.2.11"; }
backend a2 { .host = "192.0.2.12"; }
backend a3 { .host = "192.0.2.13"; }
backend a4 { .host = "192.0.2.14"; }
backend b1 { .host = "192.0.2.11"; }
backend b2 { .host = "192.0.2.12"; }
backend b3 { .host = "192.0.2.13"; }
backend b4 { .host = "192.0.2.14"; }
sub vcl_init {
new rrA = directors.round_robin();
rrA.add_backend(a1); rrA.add_backend(a2);
rrA.add_backend(a3); rrA.add_backend(a4);
new rrB = directors.round_robin();
rrB.add_backend(b1); rrA.add_backend(b2);
rrB.add_backend(b3); rrA.add_backend(b4);
}
sub vcl_recv {
set req.backend_hint = rrA.backend();
if (req.http.AppVersion == "aabbcc") {
set req.backend_hint = rrB.backend();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment