Created
November 22, 2013 18:02
-
-
Save niedbalski/7604222 to your computer and use it in GitHub Desktop.
Proxy varnish ghost blog engine on redhat openshift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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