backend apoll { .host = "apoll.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend cure { .host = "cure.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend goblin { .host = "goblin.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend gotthard { .host = "gotthard.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend hardy { .host = "hardy.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend hybris { .host = "hybris.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend krantor { .host = "krantor.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend leto { .host = "leto.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend solons { .host = "solons.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } backend white { .host = "white.map24.local."; .port = "80"; .probe = { .url = "/exodus.html"; .timeout = 30 ms; .interval = 1s; .window = 5; .threshold = 3; } } director maptp42 round-robin { { .backend = apoll; } { .backend = cure; } { .backend = goblin; } { .backend = gotthard; } { .backend = hardy; } { .backend = hybris; } { .backend = krantor; } { .backend = leto; } { .backend = solons; } { .backend = white; } } sub vcl_recv { set req.backend = maptp42; if (req.request != "GET" && req.request != "HEAD" && req.request != "PUT" && req.request != "POST" && req.request != "TRACE" && req.request != "OPTIONS" && req.request != "DELETE") { /* Non-RFC2616 or CONNECT which is weird. */ return (pipe); } if (req.request != "GET" && req.request != "HEAD") { /* We only deal with GET and HEAD by default */ return (pass); } if (req.url == "/exodus.html" ) { if (req.backend.healthy) { error 200 "OK"; } else { error 404 "Not Found"; } } if ( ! ( req.url ~ "^/lbsp/webservices1\.5\?cgi=Map24MGI.*quadkey=.*$" || req.url ~ "^/lbsp/webservices1\.5\?.*&cgi=Map24MapSearch&.*$" ) ) { /* Does not look like a quadkey request, pass to backend. How * did it get here? */ return (pass); } if (req.http.Authorization) { /* Not cacheable by default */ return (pass); } if ( req.url ~ "^/lbsp/webservices1\.5\?.*&cgi=Map24MapSearch&.*$" ) { set req.url = regsub(req.url, "\&sid=[^&]*\&", "\&"); } # normalize the Host: header if (req.http.host ~ ".*\.ctl.maptp42\.map24\.com$") { set req.http.host = "0.ctl.maptp42.map24.com"; } return (lookup); } sub vcl_fetch { if (beresp.cacheable) { /* Remove Expires from backend, it's not long enough */ unset beresp.http.expires; /* Set the clients TTL on this object */ set beresp.http.cache-control = "max-age = 900"; /* Set how long Varnish will keep it */ set beresp.ttl = 1d; /* marker for vcl_deliver to reset Age: */ set beresp.http.magicmarker = "1"; } } sub vcl_deliver { if (resp.http.magicmarker) { /* Remove the magic marker */ unset resp.http.magicmarker; /* By definition we have a fresh object */ set resp.http.age = "0"; } } # vim:ft=vcl