I have run into a problem with caching on WordPress sites. Here’s what happens:
An email is sent, reaching thousands of people. Several hundred will come to the site. The problem is that the URL is constructed like so:
The utm_term tag is unique to every recipient of the email (don’t ask, Mailchimp constructs the URL like that). Nginx then ends up caching hundreds of these URLs, because $request_uri is therefore “unique” to every link and caching is set as so:
fastcgi_cache_key “$scheme$request_method$host$request_uri”;
I’ve tried replacing this line with the following as per these instructions (link):
fastcgi_cache_key “$scheme$request_method$host$uri”;
or (with accompanying setup):
fastcgi_cache_key “$scheme$request_method$host$rt_uri”;
However, this breaks the site because $uri on a WordPress install is simply /index.php , at least that is what Nginx is spitting back when I debug using headers. And I found one possible solution using Lua, but reconfiguring the server and adding Lua seems like overkill.
So, I’m still looking for a way to strip out all the Google Analytics tags and force
to show the cached version of
http://www.website.com/nice-pretty-URL/
Hopefully my question makes sense. Any help is greatly appreciated! Thanks.