Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Proxy varnish ghost blog engine on redhat openshift
backend default {
.host = "app.rhcloud.com";
.port = "80";
}
sub vcl_recv {
set req.http.host = "app.rhcloud.com";
if (req.http.cache-control ~ "no-cache") {
set req.hash_always_miss = true;
}
set req.http.x-pass = "false";
if (req.url ~ "^/(api|signout)") {
set req.http.x-pass = "true";
} elseif (req.url ~ "^/ghost" && (req.url !~ "^/ghost/(img|css|fonts)")) {
set req.http.x-pass = "true";
}
if (req.http.x-pass == "true") {
return(pass);
}
unset req.http.cookie;
}
sub vcl_fetch {
if (req.http.x-pass != "true") {
unset beresp.http.set-cookie;
if (beresp.status < 500 && beresp.ttl == 0s) {
set beresp.ttl = 2m;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment