XF 1.4 Remove query strings from static resources

nodle

Well-known member
So I have been playing with my page speed today. I have got it up there but my number one problem it shows is "Remove query strings from static resources". I have been reading only on how to fix this. I am behind Cloudflare so I thought it may have something to do with that, but after playing around I still can't fix it. Has anyone else successfully been able to fix this with Xenforo, or does someone have an idea of how I could improve them? Thanks for the info!
 
Very easy: nothing to fix or change here :)

We append the date the avatar was last updated to the avatar URL. This serves as a cache buster, meaning that when the avatar is changed, those changes are reflected instantly instead of the old avatar image showing. Similar thing for javascript.

They're a necessary evil, but something I would actually say does far more benefit than harm.
 
I am using a CDN service provided by my host. I am on a VPS

They say the following
most images are in the code with what looks to be dynamic query
strings attached to them, which will prevent the CDN service from properly
caching those. That will slow down access to such files.


For instance, instead of calling an image directly like:

91813-932c1eb482a39ef120ea7eb308d1e4aa.jpg


The site in instead using:

91813-932c1eb482a39ef120ea7eb308d1e4aa.jpg?1416330954


Several of the css and js files also have dynamic query strings added to
them as well. With that, the pairCDN service won't be able to cache them,
so requests would have to go to the CDN, the CDN would then have to perform
a lookup at the origin each time, then serve back that result. If the URLs
were made static, without the query strings, the CDN service can then cache
and serve the cached copies of those normally.
 
The query string is essentially indicating the "version" of the file. In the case of avatars it is when the avatar was uploaded. In that sense, it isn't actually dynamically generated and the avatar URL is the same URL consistently until the avatar itself changes, and it's only then the query string part changes.

I believe some CDN providers are able to handle such things. Browsers are able to handle caching these resources with query strings locally.

It's an important mechanism which allows us to invalidate caches when it is crucial to do so, such as when JS and CSS change or indeed avatars are changes. Without such a mechanism, these files would change and those changes might not take effect for a considerable amount of time.
 
Top Bottom