I wish to know the effects of removing the query strings from ElkArte combined files for js and css as they are considered as static resources. I am testing it by commenting out this part ". $this->_archive_stale;" in the site combiner file.
And I wish to know how do I remove the query string from "fontawesome-webfont.woff2?v=4.4.0" and its effects if I do so.
The query is there to "force" refreshing on updates/upgrades.
What would be the advantage of removing it?
Actually, web tests always raise this issue and while I was seaching around, I found this: https://stackoverflow.com/a/23604412. But I don't understand it as much as programmers do, so I asked in here.
In reading that a bit, the issue of "Using query strings prevents proxy caching" seemed to be somewhat specific to the Squid-Cache, but that was also addressed back in 2008, or at least a setting was added so that it would work as expected.
I'm going to assume you have your web server set up to set expire headers on your asset files (css js images etc) that are far in the future, how far is up to you. Those directives are done in your web server configs. With those headers being sent, if you edit or add to your sites js/css files without the ?v=x.y.z your users may not see see the change, Of course even with them set a ctrl+f5 is often needed.
Those are in the font-awesome.min.css file You would have to edit that file. The downside is that without that, a cache may supply an older or newer version of that asset which may not be compatible with the rest of the css.
i ignore those warnings. too much hassle with minor benefit.
Ignoring is a good choice actually. But I like learning and doing it the other way too. This is my hobby, so nothing serious.
And considering how the cache of Chrome is persistent and "difficult" to cleanup, change the URL is actually the only reliable way to be sure the content is changed when it really needs to be...
Out of curiosity, which tools warn specifically? Using ?v=1.2.3 is quite common for good reason. You could also use something like /scriptname/1.2.3/script.js or /scriptname-v1.2.3.js instead but that might be slightly harder to implement on the server-side.
You can check using https://tools.pingdom.com and https://gtmetrix.com with a little to worry about it, as at least according to https://gtmetrix.com, its priority is low.
I however found that your suggestions are interesting since our css or js are in this kind of format: hive-xxxxxx.css/js?v.1.2.3. Can't we not implement without many hassle (via addon mainly), only using this hive-xxxxxx.css/js, and rewrite it in our server side, may be like this for nginx:
location ~* \.(css|js) {
rewrite "/(.+)\.[\d]{10}\.(css|js)$" /$1.$2 last;
}
and may be like this for apache2 htaccess
RewriteEngine on
RewriteRule ^(.*)\.[\d]{10}\.(css|js)$ $1.$2 [L]
I only think this is possible if I assume correctly that the xxxxxx in hive-xxxxxx.css/js is changed every time its sources change which might not be. ;D
If it is possible, can it be extended to woff2 file for font-awesome too?
And if possible, I'd actually prefer if all these static contents are served via cdn which is gmetrix considered as medium priority. :D
Well then I guess Elk's built in minifier could add the Unix timestamp of the most recently modified file.
I second this. I think I can may a simple addon to do that for personal test. Let me see...
And a cron job can be set up to purge old files with glob() om nom nom.
The query string (?xyz123) is currently built from the included files modified timestamp. We could move that to the actual filename but I'm not sure what we are trying to fix anymore O:-)
Yup, that's the idea. ;)