vcl 4.0; import directors; backend static_server { .host = "aa.bb.cc.dd"; .port = "80"; .probe = { .url = "/"; .timeout = 200 ms; .interval = 1s; .window = 6; .threshold = 5; } } backend static_server_2 { .host = "aa.bb.cc.ee"; .port = "80"; .probe = { .url = "/"; .timeout = 200 ms; .interval = 1s; .window = 6; .threshold = 5; } } sub vcl_init { new cluster = directors.fallback(); cluster.add_backend(static_server); cluster.add_backend(static_server_2); } sub vcl_recv { set req.backend_hint = cluster.backend(); #unset req.http.Cookie; #unset req.http.Cache-Control; }
Ref: http://smemoratesysop.blogspot.com/2015/05/failover-director-for-varnish-40.html