Minify + gZip = error on first load only (race situation?)
-
I am running latest versions of everything on nginx/mariaDB/ubuntu_20.04.
I have noticed an issue when I try to use CSS/JS minify and enable gZip compression of CSS/JS.
Steps to re-produce…
- Save & Purge W3 Cache settings
- Update the media query string
- Clear the minify cache
- Clear the page cache
- Restart nginx
- Clear the browser cache
- Refresh the page in the browser
All CSS and JS files will return a “ERR_CONTENT_DECODING_FAILED” error. If you reload the page, everything will be perfect.
If you navigate to another page which needs some different CSS/JS then this will also fail if it is the first time that CSS/JS has been called.
I wonder in this is some sort of “race situation”, perhaps with W3TC trying to serve a
minify/abc123.css_gzip
file before it has been created?This problem is made much worse if you use a CDN because this first-time issue is the one that gets cached on the CDN, so if you are using a CDN then every page will fail, even when reloaded because the faulty version has been cached.
- I have tried using “combine only” and this makes no difference – same problem.
- If I turn off compression then everything works OK, so there is no particular issue with minifying my theme’s CSS/JS
- If I turn off minify and just leave compression then everything also works OK. So there is no issue with gZip compression.
- I have tried modifying my core
/etc/nginx/nginx.conf
so that gZip is not enabled by default. Therefore all gZip declarations are being created by W3TC in the/var/www/worpress/nginx.conf
- I am pretty sure I saw a similar problem on an apache based installation I was also working on, but that project got dropped
- The topic ‘Minify + gZip = error on first load only (race situation?)’ is closed to new replies.