When a page contains too much characters, the Cloudflare scripts are added after the closing html tag, and then the browser does not load them.
For analytics script this means missed analytics, for the rocket loader script this means a broken site.
As links are not allowed I cannot add an example, but the page source is:
May I ask have you tried disabling some features at Cloudflare dashboard like:
Auto Minify options
Rocket Loader
Therefore, using “Purge Everything” to flush the cache at Cloudflare and double-checking this using a different Web browser?
I wonder, if you temporary use “Pause Cloudflare for this site” option from the bottom-right corner at the CF dashboard → Overview tab, is your HTML code valid and are all the HTML tags properly closed?
Hi @fritex , thanks for your response. I am replying in behalf of Silvan, we are both checking this issue.
I have disabled “Automatic Platform Optimization for WordPress” and “Auto Minify” (Javascripts, CSS and HTML). Rocket Loader was not enabled (we have APO).
I purged cache, and the issue remains.
About the other test, I configured my hosts file to point directly to backend server and got a direct html response without Cloudflare man in the middle. The html I got is valid, no major issues, no unclosed tags.
Html for this page is quite big, we think this could be the reason why Cloudflare is failing to parse it correctly. Is there a limit on the size?
And we are having the same issue with rocket loader. Right now rocket loader is disabled because it brokes the site.
It seems all Cloudflare scripts are being attached after closing html tag!
740174 characters in source html (not through Cloudflare)
Checked and although there are errors, none of them seem to be related. For example: Error: CSS: font-family: is an incorrect operator. Error: CSS: font-weight: 0 is not valid, only values greater than or equal to 1.0 are allowed.
but it can’t process all the file because it fails with a timeout (maybe the file size again is the reason). I am looking for an online html validator that allows me to share a link with the results.
Sure, but CF forumos does not allow me to add links.
www.swanmarket.nl is the domain, and
/product/ergonomische-zitbal-byalex-65-cm/
is an example of the wrong script tag (check at the bottom of the html, and you will see the
Howeer, on a product page, I can see the WP Super Cache plugin and my best guess is the options from it are either wrongly configured or something “on-the-fly” compresses it via “checked option” and caches the webpage as HTML, therefore serves it compressed as gzip in a bit weird way
Have you tried disabling the WP Super Cache plugin?
Nevertheless, you’re also using Cloudflare APO for WordPress.
I created a clone site so as to test it worry-free. I have disabled wp-cache plugin, purged cache, loaded page from incognito mode with browser cache disabled. Same behaviour.
Then I enabled rocket loader feature on CF, with a page rule, only for the cloned site. And now you can see at the bottom of the page that both cf analytics and rocket loader scripts are added after html tag is closed.
You can check it here.
I am afraid I have found an issue. You’ve got the issue of unclosed tag before, kindly double-check your website code, ti should be starting within the element:
If it’s a plugin, try disabling it, clear the cache and re-check. If that’s the case where it starts
Or actually, somewhere before as I analyze it …
Two div enclosed but not used somewhere after enclosing below one:
<div class="social-icons follow-icons" >
And some other div.
I wonder how it ended up and why Cloudflare adds it’s script tags of the Rocket Loader and other at the bottom to the wrong place either because of it.
Also, I wonder if the teme is closed with body and html properly or they were added by some minify or Web browser behaviour
Can you try to disable WP Super Cache and Auto Minify options at Cloudfalre for clone sub-domain?
Wonder if disabling all plugins changes anything, including Woocommerce just to see if with the installed theme is ok or not
I found the plugin that is triggering CF error. The “woo-variation-gallery” plugin, it adds some fancyness on how images are displayed. I re-enabled all plugins, also wp-cache and when I disable “woo-variation-gallery” plugin (only that one), CF adds the scripts correctly.
is still there and it does not seems to bother.
I still don’t understand why browser displays it correctly but CF is not able to parse it and add scripts after closing html tag. It is not a normal behaviour.
With the plugin enabled, try loading the page directly from the origin. Either using curl --connect-to ::IP_ADDRESS, or with Cloudflare paused. Then see if there’s anything after the closing html tag.
Nothing strange, only the wp-super-cache comments. Is the same behaviour whether we have super-cache or not. The issue only shows up with “woo-variation-gallery” plugin. Tried disable super-cache and enabling woo-variation-gallery, and CF fails to add the scripts.
No reply from CF support yet.