Skip to content

Instantly share code, notes, and snippets.

@erich
Created September 23, 2011 12:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save erich/1237268 to your computer and use it in GitHub Desktop.
Save erich/1237268 to your computer and use it in GitHub Desktop.
Varnish configuration
backend default {
.host = "127.0.0.1";
.port = "6000";
}
sub vcl_recv {
if (req.request == "PURGE")
{
return(lookup);
}
if (req.request == "GET" && !(req.url ~ "(users|admin|refinery|dialog)"))
{
unset req.http.Cookie;
set req.grace = 120s;
return (lookup);
}
}
sub vcl_fetch {
if (req.request == "GET" && !(req.url ~ "(users|admin|refinery|dialog)"))
{
set beresp.ttl = 24h;
set beresp.grace = 120s;
unset beresp.http.Set-Cookie;
#return(pass);
return(deliver);
}
}
sub vcl_hit {
if(req.request == "PURGE")
{
purge_url(req.url);
error 200 "Purged";
}
if(!obj.cacheable)
{
return(pass);
}
}
sub vcl_miss {
if(req.request == "PURGE")
{
error 200 "Not in cache";
}
return(fetch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment