Skip to content

Instantly share code, notes, and snippets.

@mauricios
Created June 30, 2016 20:35
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 mauricios/78871994cd9d99493f4b10fd32390e1e to your computer and use it in GitHub Desktop.
Save mauricios/78871994cd9d99493f4b10fd32390e1e to your computer and use it in GitHub Desktop.
Varnish 3 VCL to make cache removing cookies
backend default {
.host = "localhost";
.port = "8080";
}
sub vcl_recv {
set req.backend = default;
if (req.url !~ "(/admin)") {
unset req.http.cookie;
}
}
sub vcl_fetch {
if (req.url ~ "(/admin)") {
set beresp.ttl = 0s;
return (hit_for_pass);
} else {
unset beresp.http.set-cookie;
set beresp.ttl = 15m;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment