Ignore query parameters with fastcgi cache

I have a pretty high traffic wordpress site, doing 5-6M pageviews a day on an nginx / fascgi / php-fpm setup. Recently we started using utm parameters in our landing URLs and it caused the server to work a lot harder because of more cache misses.

I am looking into solutions including but not limited to:

  • Figuring out how to “ignore” query parameters in fastcgi. So /some-wordpress-url/?utm_source=blah&utm_term=1234 would be directed to /some-wordpress-url/ for rendering (and thus cached) while preserving the url parameters in the actual URL so Google Analytics does the right thing.
  • Changing the utm parameters to an anchor vs query parameters. So the above example would be /some-wordpress-url/#utm_source=blah&utm_term=1234
  • Increasing cache time (doing this anyways)

Any other suggestions or inputs on how to achieve the above (especially the first)?

I’ve been really struggling with this.

I think internally WordPress’s index.php uses query paramaters after a rewrite so it knows what to show.

I think you’d have to whitelist a load of paramaters or soemthing like that. It’d be good to hear what RTCamp have to say on this. If you could ignore query params in the Fastcgi Cache Key settings that’d make these wordpress sites super robust

Did you guys try method described here - Using FastCGI Cache with Affiliate tracking software (lots of query strings)

We use same method to tweak cache.

Also, please check Sites reporting fastcgi_cache BYPASS and Cache urls which use only "javascript-related queries"

Above threads have long discussion on same issue.