Skip to content

Instantly share code, notes, and snippets.

@svartalf
Created January 17, 2014 03:28
Show Gist options
  • Save svartalf/8467918 to your computer and use it in GitHub Desktop.
Save svartalf/8467918 to your computer and use it in GitHub Desktop.
Simple varnish config which will cache all responses with a X-Varnish-Age header.
import std;
backend default {
.host = "127.0.0.1";
.port = "8000";
}
sub vcl_recv {
return (lookup);
}
sub vcl_fetch {
if (beresp.http.x-varnish-age) {
set beresp.ttl = std.duration(beresp.http.x-varnish-age, 60s);
unset beresp.http.set-cookie;
unset beresp.http.vary;
unset beresp.http.x-varnish-age;
return (deliver);
}
return (hit_for_pass);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment