Skip to content

Instantly share code, notes, and snippets.

@mohamedrez
Created July 27, 2014 14:50
Show Gist options
  • Save mohamedrez/570cbb43b60304600c2d to your computer and use it in GitHub Desktop.
Save mohamedrez/570cbb43b60304600c2d to your computer and use it in GitHub Desktop.
Varnish conf for Maaal
backend default {
.host = "127.0.0.1";
.port = "8080";
}
# Drop any cookies sent to Wordpress.
sub vcl_recv {
if (!(req.url ~ "wp-(login|admin)")) {
unset req.http.cookie;
}
}
# Drop any cookies Wordpress tries to send back to the client.
sub vcl_fetch {
if (!(req.url ~ "wp-(login|admin)")) {
unset beresp.http.set-cookie;
#set minimum cache lifetime
set beresp.ttl = 96h;
}
}
acl purge {
"localhost";
"127.0.0.1";
"80.240.133.39";
}
sub vcl_recv {
# allow PURGE from localhost and 192.168.55...
if (req.request == "PURGE") {
if (!client.ip ~ purge) {
error 405 "Not allowed.";
}
return (lookup);
}
}
sub vcl_hit {
if (req.request == "PURGE") {
purge;
error 200 "Purged.";
}
}
sub vcl_miss {
if (req.request == "PURGE") {
purge;
error 200 "Purged.";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment