Skip to content

Commit 8787943

Browse files
committed
Bump to v0.2.39
Revert "Merge pull request #62 from genesis/28-varnish-vcl-cleanup" aa9e83f This reverts commit aa9e83f, reversing changes made to 9753fa4.
1 parent 68bf492 commit 8787943

5 files changed

Lines changed: 43 additions & 22 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ sudo /Library/StartupItems/VirtualBox/VirtualBox restart
300300

301301
## Changelog
302302

303+
- v0.2.39 – Revert v0.2.37 (aa9e83f)
303304
- v0.2.38 – Move events to after `deploy:update_code` ([#82](https://github.com/genesis/wordpress/pull/82))
304305
- v0.2.37 – Fix isues with Varnish ([#62](https://github.com/genesis/wordpress/pull/62):
305306
- Cleaned up cookie logic in `production.vcl` (see #28, and 3fd9d0c)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "genesis-wordpress",
4-
"version": "0.2.33",
4+
"version": "0.2.39",
55
"description": "Libraries for a multi-staged WordPress workflow with Vagrant",
66
"main": "generator/app/index.js",
77
"dependencies": {

provisioning/roles/varnish/files/etc-default-varnish

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ VARNISH_STORAGE_SIZE=512M
3838
VARNISH_SECRET_FILE=/etc/varnish/secret
3939

4040
# Backend storage specification
41-
VARNISH_STORAGE="file,${VARNISH_STORAGE_FILE},${VARNISH_STORAGE_SIZE}"
41+
VARNISH_STORAGE="malloc,${VARNISH_STORAGE_SIZE}"
4242

4343
# Default TTL used when the backend does not specify one
4444
VARNISH_TTL=120
Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
# Pass all login requests straight through
2-
if (req.url ~ "wp-login") {
1+
# Pass all local or login/admin requests straight through
2+
if (req.http.Host ~ "^local\." || (req.url ~ "wp-(login|admin)")) {
33
return (pass);
44
}
5-
# Pipe all admin requests directly
6-
if (req.url ~ "wp-admin") {
7-
return (pipe);
8-
}
95

10-
# Pass all requests containing a wp- or wordpress_ cookie
11-
# (meaning NO caching for logged in users)
12-
if (req.http.Cookie ~ "^([^;]+;\s*)*?(wp-|wordpress_)") {
6+
if (req.http.Cookie ~ "^wp-" || req.http.Cookie ~ "^wordpress_") {
137
return (pass);
148
}
159

16-
# Drop *all* cookies sent to Wordpress, if we've gotten this far
17-
unset req.http.Cookie;
10+
# Drop any cookies sent to Wordpress.
11+
if (!(req.url ~ "wp-(login|admin)")) {
12+
unset req.http.Cookie;
13+
}
14+
15+
# Anything else left?
16+
if (!req.http.Cookie) {
17+
unset req.http.Cookie;
18+
}
1819

1920
# Try a cache-lookup
2021
return (lookup);

provisioning/roles/varnish/files/etc-varnish/production.vcl

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,28 @@ sub vcl_recv {
9494
#
9595

9696
# Some generic cookie manipulation, useful for all templates that follow
97+
# Remove the "has_js" cookie
98+
set req.http.Cookie = regsuball(req.http.Cookie, "has_js=[^;]+(; )?", "");
9799

98-
# Remove any '_' prefixed cookies
99-
set req.http.Cookie = regsuball(req.http.Cookie, "_[^=]+=[^;]+(; )?", "");
100+
# Remove any Satallite cookies
101+
set req.http.Cookie = regsuball(req.http.Cookie, "__gaid=[^;]+(; )?", "");
102+
set req.http.Cookie = regsuball(req.http.Cookie, "_sdsat_[^=]+=[^;]+(; )?", "");
103+
104+
# Remove any Google Analytics based cookies
105+
set req.http.Cookie = regsuball(req.http.Cookie, "__utm.=[^;]+(; )?", "");
106+
set req.http.Cookie = regsuball(req.http.Cookie, "_ga=[^;]+(; )?", "");
107+
set req.http.Cookie = regsuball(req.http.Cookie, "utmctr=[^;]+(; )?", "");
108+
set req.http.Cookie = regsuball(req.http.Cookie, "utmcmd.=[^;]+(; )?", "");
109+
set req.http.Cookie = regsuball(req.http.Cookie, "utmccn.=[^;]+(; )?", "");
110+
111+
# Remove any Cloudflare cookies
112+
set req.http.Cookie = regsuball(req.http.Cookie, "__cfduid=[^;]+(; )?", "");
113+
114+
# Remove the Quant Capital cookies (added by some plugin, all __qca)
115+
set req.http.Cookie = regsuball(req.http.Cookie, "__qc.=[^;]+(; )?", "");
116+
117+
# Remove the AddThis cookies
118+
set req.http.Cookie = regsuball(req.http.Cookie, "__atuvc=[^;]+(; )?", "");
100119

101120
# Remove a ";" prefix in the cookie if present
102121
set req.http.Cookie = regsuball(req.http.Cookie, "^;\s*", "");
@@ -129,10 +148,10 @@ sub vcl_recv {
129148
# 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.
130149
# Sure, there's disk I/O, but chances are your OS will already have these files in their buffers (thus memory).
131150
# Before you blindly enable this, have a read here: http://mattiasgeniar.be/2012/11/28/stop-caching-static-files/
132-
# 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)(\?.*)?$") {
133-
# unset req.http.Cookie;
134-
# return (lookup);
135-
# }
151+
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)(\?.*)?$") {
152+
unset req.http.Cookie;
153+
return (lookup);
154+
}
136155

137156
# Send Surrogate-Capability headers to announce ESI support to backend
138157
set req.http.Surrogate-Capability = "key=ESI/1.0";
@@ -226,9 +245,9 @@ sub vcl_fetch {
226245
# Enable cache for all static files
227246
# 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.
228247
# Before you blindly enable this, have a read here: http://mattiasgeniar.be/2012/11/28/stop-caching-static-files/
229-
# 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)(\?.*)?$") {
230-
# unset beresp.http.set-cookie;
231-
# }
248+
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)(\?.*)?$") {
249+
unset beresp.http.set-cookie;
250+
}
232251

233252
# Sometimes, a 301 or 302 redirect formed via Apache's mod_rewrite can mess with the HTTP port that is being passed along.
234253
# This often happens with simple rewrite rules in a scenario where Varnish runs on :80 and Apache on :8080 on the same box.

0 commit comments

Comments
 (0)