• Resolved Hannes Leismann

    (@hanneslsm)


    Hello there,
    I’ve created a website with a custom block theme and even got the website to get all 100 points on the Lighthouse test, also because of the plugin. Thank you very much!

    However, visitors complain about the website being broken.
    I only can replicate this issue when visiting the site with a VPN (interestingly not always, maybe a localisation issue?).
    The console logs the error
    Uncaught SyntaxError: Unexpected token '<'

    Here is a screen recording that shows the issue better than I could explain:

    The page I need help with: [log in to see the link]

Viewing 11 replies - 1 through 11 (of 11 total)
  • That is odd. I saw the same thing but when I added a random number to the URL, like ?123 it generated a new cache file and that version was ok.

    I think there’s a bug on your site causing this error, that only shows to some users. This plugin caches it as a static html page and then that html is served to everyone.

    I saved the html of your front page twice, once when it was broken, once when it was fixed and saw a few odd differences. Even the body tag was different:

    <body data-cmplz=”2″ class=”home page-template page-template-PageFullwidthnotitle page page-id-23 wp-custom-logo wp-embed-responsive cmplz-preferences cmplz-functional cmplz-eu cmplz-optin” data-aos-easing=”ease” data-aos-duration=”400″ data-aos-delay=”0″>

    Body tag on fixed homepage

    <body data-cmplz=”2″ class=”home page-template page-template-PageFullwidthnotitle page page-id-23 wp-custom-logo wp-embed-responsive”>

    Body tag on broken homepage

    The later <a chunk of code links to an actual image on the fixed site, but on the broken one, it uses an uuencoded image.

    Maybe disable some of the optimization plugins you have installed and see if that makes a difference? I’m confident it’s not a problem in this plugin. It’s only highlighting the problem because the broken pages are cached.

    Thread Starter Hannes Leismann

    (@hanneslsm)

    Thanks for the quick response and testing!
    I now have all plugins deactivated and only WP Super cache activated.
    This issue still exists having WP super cache activated without any other plugins. It must at least somehow related to this plugin.
    Can you try again on your end?

    Could it be something coming from the theme? I have build it from scratch using the create block theme plugin https://github.com/hanneslsm/prolooks-3


    Thread Starter Hannes Leismann

    (@hanneslsm)

    I was able to reproduce the issue. It’s definitely coming from the WP Super Cache Plugin. The issue occurs after the cache is generated.

    Thanks for the video. That is enlightening. Can you send me a copy of your theme so I can try it on a test site? There’s a form on https://odd.blog/the-development-version-of-wp-super-cache/ you can use, if you can zip it up for me, put it on Dropbox, or your site and send me a link to it, I will test it.

    Does the theme have any user agent sniffing so it displays things differently to some browsers? I noticed the page was corrupted when you ran the tester, so I tried to grab it (using GET parameters for fresh caches) with wget and curl but the cached versions were ok.

    The plugin uses an output buffer to grab the contents of the page to store it. It doesn’t do any minification of the JavaScript or modify CSS or images at all, unless you have the CDN feature enabled. That CDN feature just rewrites hostnames. It doesn’t convert them to uuencoded data for example.

    Thread Starter Hannes Leismann

    (@hanneslsm)

    Thank you for looking into it!

    The theme is on Github: https://github.com/hanneslsm/prolooks-3

    Thread Starter Hannes Leismann

    (@hanneslsm)

    Does the theme have any user agent sniffing so it displays things differently to some browsers??

    No, I’m not aware of any. If so, then only because the Create Block theme plugin or Gutenberg has added any.

    The issue occurs also in iOS Safari and Firefox.

    I managed to download a copy of your front page when it was broken. There’s something weird going on there. The broken page has translated elements like “Comments Feed” and is using style.min.css where the fixed page uses the German “Kommentar-Feed” and uses style.css

    I noticed something that might be the reason for this. I loaded your page but some of the images were blank. I opened the image in a new browser tab and instead of the image I saw your homepage again. When I refreshed, the image appeared.

    I did the same with viewing the source of style.min.css when the page looked broken and your front page source showed. When I refreshed, the minified css file showed.

    Do you have a reverse proxy in front of your site? Or some sort of local proxy or mod_rewrite rules or something that’s supposed to cache static content?

    Thread Starter Hannes Leismann

    (@hanneslsm)

    Do you have a reverse proxy in front of your site? Or some sort of local proxy or mod_rewrite rules or something that’s supposed to cache static content?

    I am not aware of this, but I’ll check in with my hoster.

    Thread Starter Hannes Leismann

    (@hanneslsm)

    I don’t know much about server configuration and caching, but I found that nginx cache was activated. Deactivating it did in fact resolve the issue, however I do not see any difference in loading times between nginx caching or using the plugin.

    The server configuration settings: https://docs.plesk.com/en-US/obsidian/customer-guide/websites-and-domains/hosting-settings/web-server-settings/apache-and-nginx-settings.72320/#enabling-nginx-caching

    What would be the advantage of using the WP Super cache plugin over the nginx cache? Is there any difference? Using both simultaneously doesn’t seem to work.

    Thread Starter Hannes Leismann

    (@hanneslsm)

    I guess the nginx caching was the issue. I now deactivated it and keep the Plugin. Thanks for pointing me to the solution!

    Glad to hear it’s fixed!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Uncaught SyntaxError: Unexpected token ‘<'’ is closed to new replies.