HTML Minify – v0.9.2
-
Hi guys,
I use W3TC (Minifcation disabled) + Autoptimize (currently HTML Minify disabled) and using v0.9.2 bricks the frontend of my site. Based on my investigation – JS doesn’t run, Autoptimize minified scripts and CSS are cached and then permanently served (regardless of clearing cache), all of which prevents images loading and changing pages on my site, as my site is reliant on lazyloading images + infinite scrolling.I’m assuming that the bug introduced as part of v0.9/0.9.1 (https://blog.futtta.be/2019/01/27/warning-bug-in-w3-total-cache-impacts-autoptimize/ & https://ww.wp.xz.cn/support/topic/last-update-destroyed-html-minify-settings/ – CC: @optimizingmatters / @futtta / @vmarko ) still exists through to 0.9.2?
Therefore, are you able to confirm if/when this issue will be resolved?
-
Given I’m CC’ed some questions:
* when did the problem start?
* HTML minify is entirely off (in W3TC & AO) when you encounter this?
* does the problem go away with W3TC (temporarily) disabled?
* does the problem go away with AO (temporarily) disabled?
* what JS errors do you see on the browser console?
* what (if any) is the workaround to fix this?
* can you share your site’s URL?frank
Hello,
The issue started with 0.9.7.1 version and it was quickly resolved in 0.9.7.2.
If you disable W3 Total Cache does the issue persist?Hi @vmarko – No, if I disable W3TC v0.9.7.2 or roll back to v0.9.7.0, the issue stops immediately.
@optimizingmatters:
* when did the problem start?
As soon as I update to W3TC 0.9.7.1 or 0.9.7.2
* HTML minify is entirely off (in W3TC & AO) when you encounter this?
Yes, both disabled completely.
* does the problem go away with W3TC (temporarily) disabled?
Yes
* does the problem go away with AO (temporarily) disabled?
I haven’t tried this (because I use CCSS), but I will test and confirm.
* what JS errors do you see on the browser console?
None – the only errors I see relate to autoptimize js and css not existing
* what (if any) is the workaround to fix this?
I’ve rolled back to 0.9.7.0 and everything is perfectly fine!
* can you share your site’s URL?
https://willstocks.co.ukthe only errors I see relate to autoptimize js and css not existing
-> are there files in wp-content/cache/autoptimize/css or js?
-> and clearing W3TC’s cache doesn’t fix that?@optimizingmatters:
-> are there files in wp-content/cache/autoptimize/css or js?
Yes, there are. But the references that are pulled through when W3TC is enabled are incorrect (I can’t work out if old versions that are somehow “stuck” (see below) or if it’s mangling the refs). I will try to spin up a staging site later today to demonstrate the issue first-hand!
-> and clearing W3TC’s cache doesn’t fix that?
My thoughts exactly – but unfortunately, no amount of cache clearing makes a difference. I even tried editing CSS and JS (to generate new AO refs), clearing the AO cache AND W3TC caches (all – Page, DB, CDN, Cloudflare, Opcache) and it makes no difference, the issue persists 🙁and are the AO files referenced in the HTML when W3TC is active always the same (as in exact same URL)?
It was a week or so ago now, so I don’t remember _exactly_, but I’m 75% sure that they were…
Best thing to do is for me to get a staging environment set up which I can link you to! 🙂
Right…
So I can’t replicate it in staging for some reason (it’s an EXACT copy of my site, but I wonder whether it’s because it’s fresh and has had no data updates since), but:
GET https://willstocks.co.uk/wp-content/cache/autoptimize/js/autoptimize_edd71b4828d50f10e8224220bf9763fc.js net::ERR_ABORTED 404 /wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css:1 GET https://willstocks.co.uk/wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css net::ERR_ABORTED 404I see these errors (current AO file is:
autoptimize_5fe0923896125bd1965e86d0cfe3cf96.cssandautoptimize_a64f6e008422fbabbb7a3ec5536062bc.js)I opened my site (logged in to wp-admin) and everything loaded fine. I cleared all caches (just to make sure – AO AND W3TC) and reloaded – everything was fine. So I continued to open an incognito tab and boom, the error is there. I also noticed one of my recent posts was missing, so I emptied Chrome cache and reloaded – same again. I checked the W3TC comment at the bottom of
<body>and it was showing the last updated date as 07-01-19.I have now reverted to 0.9.7 and things work perfectly fine… I truly don’t understand as the sites are like for like (literally copied all site files and DB!!!!)
I’m happy to arrange access for you (I have setup an account in the staging environment) if someone wants to get in touch with me via email? ([email protected])
I’m trying to check error files and all I can find so far is:
AH01071: Got error 'PHP message: PHP Warning: Cannot assign an empty string to a string offset in /wp-includes/class.wp-scripts.php on line 445\nPHP message: PHP Warning: Cannot assign an empty string to a string offset in /wp-includes/class.wp-scripts.php on line 445\n', referer: https://willstocks.co.uk/?w3tc_note=flush_alland quite a lot of:
AH01071: Got error 'PHP message: PHP Warning: count(): Parameter must be an array or an object that implements Countable in /wp-content/plugins/w3-total-cache/Cdn_Plugin.php on line 1203\n', referer: https://willstocks.co.uk/nginx error:
open() "/wp-content/cache/autoptimize/js/autoptimize_a64f6e008422fbabbb7a3ec5536062bc.js" failed (2: No such file or directory)status_code:404 IPADDRESSREMOVED [11/Feb/2019:14:13:21 +0000] GET /wp-content/cache/autoptimize/js/autoptimize_edd71b4828d50f10e8224220bf9763fc.js HTTP/1.1 status_code:404 IPADDRESSREMOVED [11/Feb/2019:14:13:22 +0000] GET /wp-content/cache/autoptimize/js/autoptimize_edd71b4828d50f10e8224220bf9763fc.js HTTP/1.1 status_code:404 IPADDRESSREMOVED [11/Feb/2019:14:13:22 +0000] GET /wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css HTTP/1.1 status_code:404 IPADDRESSREMOVED [11/Feb/2019:14:13:23 +0000] GET /wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css HTTP/1.1 status_code:404 IPADDRESSREMOVED [11/Feb/2019:14:13:31 +0000] GET /wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css HTTP/1.1 status_code:404 IPADDRESSREMOVED [11/Feb/2019:14:13:37 +0000] GET /wp-content/cache/autoptimize/js/autoptimize_edd71b4828d50f10e8224220bf9763fc.js HTTP/1.1PHP access logs:
IPADDRESSREMOVED , 127.0.0.1 - [11/Feb/2019:14:13:20 +0000] "GET /index.php" 404 0 - 22594 21535 0.875 14680064 48.02% 12.58% "/wp-content/cache/autoptimize/js/autoptimize_edd71b4828d50f10e8224220bf9763fc.js" IPADDRESSREMOVED , 127.0.0.1 - [11/Feb/2019:14:13:21 +0000] "GET /index.php" 404 0 - 22594 21535 0.736 8388608 51.66% 13.59% "/wp-content/cache/autoptimize/js/autoptimize_edd71b4828d50f10e8224220bf9763fc.js" IPADDRESSREMOVED , 127.0.0.1 - [11/Feb/2019:14:13:21 +0000] "GET /index.php" 404 0 - 22594 21612 0.665 25165824 63.17% 16.55% "/wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css" IPADDRESSREMOVED , 127.0.0.1 - [11/Feb/2019:14:13:22 +0000] "GET /index.php" 404 0 - 22594 21535 0.579 6291456 74.28% 15.55% "/wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css" IPADDRESSREMOVED , 127.0.0.1 - [11/Feb/2019:14:13:30 +0000] "GET /index.php" 404 0 - 22594 21612 0.531 14680064 79.16% 15.08% "/wp-content/cache/autoptimize/css/autoptimize_b198bdb91c81033d22d83caf5514df6d.css" IPADDRESSREMOVED , 127.0.0.1 - [11/Feb/2019:14:13:36 +0000] "GET /index.php" 404 0 - 22594 21612 1.505 8388608 34.56% 13.29% "/wp-content/cache/autoptimize/js/autoptimize_edd71b4828d50f10e8224220bf9763fc.js"PHP slow log:
[11-Feb-2019 14:10:42] [pool mycluster] pid 21423 script_filename = myserver/public_html/index.php [0x00007fa7c061d050] get() myserver/public_html/wp-content/plugins/w3-total-cache/Cache_Redis.php:86 [0x00007fa7c061cf70] get_with_old() myserver/public_html/wp-content/plugins/w3-total-cache/Cache_Base.php:96 [0x00007fa7c061cec0] get() myserver/public_html/wp-content/plugins/w3-total-cache/ObjectCache_WpObjectCache_Regular.php:157 [0x00007fa7c061cd70] get() myserver/public_html/wp-content/plugins/w3-total-cache/ObjectCache_WpObjectCache.php:36 [0x00007fa7c061ccc0] get() myserver/public_html/wp-content/object-cache.php:52 [0x00007fa7c061cc10] wp_cache_get() myserver/public_html/wp-includes/functions.php:5260 [0x00007fa7c061cb60] _get_non_cached_ids() myserver/public_html/wp-includes/post.php:6465 [0x00007fa7c061ca70] _prime_post_caches() myserver/public_html/wp-includes/media.php:1341 [0x00007fa7c061c960] wp_make_content_images_responsive() myserver/public_html/wp-includes/class-wp-hook.php:286 [0x00007fa7c061c880] apply_filters() myserver/public_html/wp-includes/plugin.php:203 [0x00007fa7c061c7c0] apply_filters() myserver/public_html/wp-includes/feed.php:190 [0x00007fa7c061c740] get_the_content_feed() myserver/public_html/wp-includes/feed-rss2.php:101 [11-Feb-2019 14:12:07] [pool mycluster] pid 21535 script_filename = myserver/public_html/wp-cron.php [0x00007fa7c061e550] sleep() myserver/public_html/wp-content/plugins/autoptimize-criticalcss/inc/cron.php:129 [0x00007fa7c061e3a0] ao_ccss_queue_control() myserver/public_html/wp-includes/class-wp-hook.php:286 [0x00007fa7c061e2c0] apply_filters() myserver/public_html/wp-includes/class-wp-hook.php:310 [0x00007fa7c061e250] do_action() myserver/public_html/wp-includes/plugin.php:515 [0x00007fa7c061e190] do_action_ref_array() myserver/public_html/wp-cron.php:126Not sure if any of this is of any use… I don’t know what’s going on and why!
Hello @willstockstech,
I believe that it has something to do with page cache rules in NginX conf. Please try to update NginX rules manually by checking the install page of our plugin and reload NginX config.
Of course backup your Nginx config first.Hi @vmarko – I will have to speak to my host, as the nginx conf isn’t something I have access to (I use Cloudways for hosting).
I will ask them to confirm the current ruleset that is applied, to try and clarify this for you.
Please also see: https://github.com/futtta/autoptimize/issues/229 as it is not only me seeing this issue, and with 0.9.7 I don’t have this issue at all and AO hasn’t updated in 2 months/doesn’t really touch nginx as far as I’m aware – so it’s clearly some change/incompatibility between the two with 0.9.7.1/0.9.7.2. I tried looking at the diff (https://plugins.trac.ww.wp.xz.cn/changeset?sfp_email=&sfph_mail=&reponame=&new=2018481%40w3-total-cache&old=1864400%40w3-total-cache&sfp_email=&sfph_mail=) but the changes are fairly extensive and I got lost halfway through!
I have recently switched hosting, directly with DigitalOcean now, so I have full control over my
nginx.conffile.I will retry upgrading now. My nginx conf at the moment has the following in it relating to caching:
`
set $skip_cache 0;
set $skip_reason “”;
proxy_cache_key $scheme$host$request_uri;if ($http_cookie ~* “comment_author_|wordpress_(?!test_cookie)|wp-postpass_” ) {
set $skip_cache 1;
set $skip_reason Cookie;
}if ($request_uri ~* “/wp-admin/|/xmlrpc.php|wp-.*.php|/feed/|sitemap(_index)?.xml”) {
set $skip_cache 1;
set $skip_reason URI;
}
add_header Cache-BYPASS-Reason $skip_reason;location / {
try_files $uri $uri/ /index.php?$args;
proxy_buffering on;
proxy_cache edge-cache;
proxy_cache_revalidate on;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_bypass $skip_cache;
proxy_no_cache $skip_cache;
proxy_cache_valid 200 301 302 500m;
proxy_cache_valid 404 1m;
add_header X-Cache-Status $upstream_cache_status;
#add_header X-Handled-By $proxy_host;
add_header Cache-BYPASS-Reason $skip_reason;
}location ~ \.php$ {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://127.0.0.1:8080$request_uri;
add_header Front-End-Https on;
proxy_redirect off;
proxy_buffering on;
proxy_cache edge-cache;
proxy_cache_revalidate on;
proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504;
proxy_cache_bypass $skip_cache;
proxy_no_cache $skip_cache;
proxy_cache_valid 200 301 302 500m;
proxy_cache_valid 404 1m;
add_header X-Cache-Status $upstream_cache_status;
#add_header X-Handled-By $proxy_host;
add_header Cache-BYPASS-Reason $skip_reason;
}
`I did originally have Apache set to use
mod_disk_cacheas well, but that broke my entire site completely (every single URL would point to a single file – whichever was visited first and cached) which I’m still yet to work out why/what’s happening there.OK – Can confirm that the issue no longer appears to exist! I’m now running 0.9.2 on my DO server and everything _appears_ to be working OK!
Therefore, it leads me to believe it’s something hosting/config-side, but I’m not sure where to start with regards to helping with that as I had no nginx.conf/apache virtualhost access @ Cloudways – but I’m leaning towards aggressive caching server-side or incompatible caching methods in W3TC being the issue!
Hello @willstockstech,
I am glad to know that you found the solution to the issue you were having. Also thanks for sharing such detailed info. Much appreciated!
How is it price?
The topic ‘HTML Minify – v0.9.2’ is closed to new replies.