Permalink
Browse files

Cautionary remarks placed on caching static files by default in the c…

…onfig with link to more explanatory blogpost
  • Loading branch information...
1 parent 41a2c4a commit 16b3df50e0828fe6d35e5f92ba8a35008c5d9d52 @mattiasgeniar committed Nov 27, 2012
Showing with 5 additions and 0 deletions.
  1. +1 −0 conf.d/fetch/drupal7.vcl
  2. +1 −0 conf.d/fetch/forkcms.vcl
  3. +1 −0 conf.d/receive/drupal7.vcl
  4. +2 −0 production.vcl
View
@@ -1,6 +1,7 @@
# The vcl_fetch routine, when the request is fetched from the backend
# For static content related to the theme, strip all backend cookies
+# Before you blindly enable this, have a read here: http://mattiasgeniar.be/2012/11/28/stop-caching-static-files/
if (req.url ~ "^/themes/" && req.url ~ "\.(css|js|png|gif|jp(e?)g)") {
unset beresp.http.cookie;
}
View
@@ -7,6 +7,7 @@ if (req.url !~ "(private|backend)") {
}
# For static content related to the theme, strip all backend cookies
+# Before you blindly enable this, have a read here: http://mattiasgeniar.be/2012/11/28/stop-caching-static-files/
if (req.url ~ "^/frontend/" && req.url ~ "\.(css|js|png|gif|jp(e?)g)") {
unset beresp.http.cookie;
}
@@ -7,6 +7,7 @@ if (req.url ~ "/admin/?") {
}
# Static content unique to the theme can be cached (so no user uploaded images)
+# Before you blindly enable this, have a read here: http://mattiasgeniar.be/2012/11/28/stop-caching-static-files/
if (req.url ~ "^/themes/" && req.url ~ "\.(css|js|png|gif|jp(e)?g)") {
unset req.http.cookie;
}
View
@@ -107,6 +107,7 @@ sub vcl_recv {
# Remove all cookies for static files
# A valid discussion could be held on this line: do you really need to cache static files that don't cause load? Only if you have memory left.
# Sure, there's disk I/O, but chances are your OS will already have these files in their buffers (thus memory).
+ # Before you blindly enable this, have a read here: http://mattiasgeniar.be/2012/11/28/stop-caching-static-files/
if (req.url ~ "^[^?]*\.(bmp|bz2|css|doc|eot|flv|gif|gz|ico|jpeg|jpg|js|less|mp[34]|pdf|png|rar|rtf|swf|tar|tgz|txt|wav|woff|xml|zip)(\?.*)?$") {
unset req.http.Cookie;
return (lookup);
@@ -209,6 +210,7 @@ sub vcl_fetch {
# Enable cache for all static files
# The same argument as the static caches from above: monitor your cache size, if you get data nuked out of it, consider giving up the static file cache.
+ # Before you blindly enable this, have a read here: http://mattiasgeniar.be/2012/11/28/stop-caching-static-files/
if (req.url ~ "^[^?]*\.(bmp|bz2|css|doc|eot|flv|gif|gz|ico|jpeg|jpg|js|less|mp[34]|pdf|png|rar|rtf|swf|tar|tgz|txt|wav|woff|xml|zip)(\?.*)?$") {
unset beresp.http.set-cookie;
}

0 comments on commit 16b3df5

Please sign in to comment.