Skip to content

Instantly share code, notes, and snippets.

@niedbalski
Created November 22, 2013 18:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save niedbalski/7604222 to your computer and use it in GitHub Desktop.
Save niedbalski/7604222 to your computer and use it in GitHub Desktop.
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