Created
September 3, 2015 14:35
-
-
Save litzinger/16e7d763dec93e23369f to your computer and use it in GitHub Desktop.
Basic configuration for EE and Varnish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
backend default { | |
# .host = "XXX.XXX.XXX.XXX"; | |
.host = "127.0.0.1"; | |
.port = "8080"; | |
} | |
sub vcl_recv { | |
# Forward client's IP to backend | |
remove req.http.X-Forwarded-For; | |
set req.http.X-Forwarded-For = client.ip; | |
if (req.url ~ "^/system" || | |
req.url ~ "^/admin.php" || | |
req.url ~ "^/admin" || | |
req.url ~ "^/preview-entries" || | |
req.url ~ "ACT=" || | |
req.request == "POST") { | |
return (pass); | |
} | |
# Purge site from cache when | |
if (req.request == "EE_PURGE") { | |
ban("req.http.host ~ domain.com && req.url ~ ^/.*$"); | |
error 200 "Purged"; | |
} | |
unset req.http.Cookie; | |
return (lookup); | |
} | |
sub vcl_fetch { | |
set beresp.ttl = 60s; | |
return (deliver); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment