Skip to content

Instantly share code, notes, and snippets.

@rodrigodealer
Created August 28, 2013 22:18
Show Gist options
  • Save rodrigodealer/6372096 to your computer and use it in GitHub Desktop.
Save rodrigodealer/6372096 to your computer and use it in GitHub Desktop.
Simple varnish setup
backend default {
.host = "127.0.0.1";
.port = "80";
}
sub vcl_recv {
if(req.url ~ "sign_in" || req.url ~ "sign_out" || req.request == "POST" || req.request == "PUT" || req.request == "DELETE") {
return (pass);
}
return (lookup);
}
sub vcl_fetch {
# if(req.url ~ "logout" || req.url ~ "/users/sign_out"){
# unset beresp.http.Set-Cookie;
# }
if (req.request == "GET") {
unset beresp.http.Set-Cookie;
# set beresp.cacheable = true;
set beresp.ttl = 360m;
}
if (req.url ~ "images/" || req.url ~ "javascripts" || req.url ~ "stylesheets" || req.url ~ "assets"){
set beresp.ttl = 360m;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment