Fallback Director
vcl 4.0;
import directors;
probe healthcheck {
.url = "/";
.interval = 2s;
.timeout = 1s;
.window = 3;
.threshold = 2;
.initial = 1;
.expected_response = 200;
}
backend admin {
.host = "admin.example.com";
.probe = healthcheck;
}
backend public {
.host = "public.example.com";
.probe = healthcheck;
}
sub vcl_init {
new loadbalance = directors.fallback();
loadbalance.add_backend(admin);
loadbalance.add_backend(public);
}
sub vcl_recv {
set req.backend_hint = loadbalance.backend();
}Last updated