Skip to content

Instantly share code, notes, and snippets.

@darron

darron/gist:380942

Created Apr 27, 2010
Embed
What would you like to do?
backend default {
.host = "backendsite";
.port = "80";
.probe = {
.url = "/probe.html";
.timeout = 10 s;
.interval = 30 s;
.window = 10;
.threshold = 8;
.initial = 10;
}
}
sub vcl_recv {
set req.http.Host = "backendsite";
set req.grace = 1h;
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.request == "GET" && req.url ~ "^/cmsdirectory/") {
error 750 "Moved Temporarily";
}
return(lookup);
}
sub vcl_error {
if (obj.status == 750) {
set obj.http.Location = "http://backendsite/cmsdirectory/";
set obj.status = 302;
return(deliver);
}
}
sub vcl_fetch {
if (beresp.ttl < 300s) {
set beresp.ttl = 300s;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment