Pantheon Community

Anyone have any thoughts on removing query strings from static resources?

Anyone have any thoughts on removing query strings from static resources? It seems to be “old school” advice. But I still see a lot of sites doing it.

This is a good article about it:

Old school advice or still worth doing?

Hi Jeremy,

Removing query strings to improve load time is outdated advice and no longer considered a best practice, even by Google.

In fact, most of the time this has the opposite effect. For example, by stripping query string versions from WordPress assets, your essentially invalidating long term caching for those assets.

Not to mention, it makes it that much harder to bust the cache when you deploy a minor change.

Also, when you strip all query strings, utm_ strings that are in place to track advertising campaign performance no longer work.

Finally, Pantheon’s caching is already optimized to strip all parameters that do not start with __ or utm_.

Even though the parameters are stripped. They are still passed along.

Here’s some more information about this

Also check out this.

If you have the time, you can easily weigh the pros and cons by running before and after page speed tests on

Just make sure you run at least 5-7 tests to get a good average. Also, make sure your testing initial load times and repeat visit load times.

Please post your findings if you run some tests.

Hope this helps.

I agree with @jsdev that the advice is outdated.

My favorite way to check caching behavior is with curl -I which shows the response headers from a URL.

For instance, here’s a URL of an image from Pantheon’s blog

curl -I  ""
HTTP/2 200
cache-control: max-age=31622400
content-type: image/jpeg
etag: "5d4075c2-16fe"
expires: Thu, 13 Aug 2020 00:31:54 GMT
last-modified: Tue, 30 Jul 2019 16:52:18 GMT
server: nginx
x-pantheon-styx-hostname: styx-fe2-a-68cd578b5b-29z88
x-styx-req-id: bff33659-bd61-11e9-9e8a-fa8867b511ce
date: Wed, 14 Aug 2019 14:42:44 GMT
x-served-by: cache-mdw17367-MDW, cache-chi21138-CHI
x-cache: HIT, HIT
x-cache-hits: 1, 1
x-timer: S1565793764.064663,VS0,VE1
age: 137450
accept-ranges: bytes
via: 1.1 varnish
content-length: 5886

That age header shows that this image has been cached in our CDN for a long time.

1 Like

I WISH that I could disable the stripping of UTM variables from URLs!!