Compatibility Issue Between LiteSpeed Cache (ESI) and CleanTalk JavaScript
-
Hello LiteSpeed Cache Team,
we are experiencing a critical compatibility issue on wohnboutique24.ch, where we use LiteSpeed Cache with ESI enabled together with the CleanTalk plugin. Problem
LiteSpeed Cache minifies JavaScript injected by CleanTalk in the page
<head>, which breaks the JSON structure of thectPublicFunctionsobject. Specifically:- Spaces and line breaks are removed.
- Extra commas may be added (
{"key": "value",}instead of{"key": "value"}). - The resulting JSON is invalid and triggers parsing errors.
Browser error example:
(index):19 Uncaught SyntaxError: Invalid or unexpected token apbct-public-bundle.min.js:1 Uncaught ReferenceError: ctPublicFunctions is not definedBroken snippet in HTML:
<script data-no-defer="1" data-ezscrex="false" data-cfasync="false" data-pagespeed-no-defer="" data-cookieconsent="ignore"> var ctPublicFunctions = {"_ajax_nonce":"3433306eea","_rest_nonce":"782ac27bfe","_ajax_url":"\/wp-admin\/admin-ajax.php","_rest_url":"https:\/\/wohnboutique24.ch\/wp-json\/", ... ,"text__ee_decoding_process":"Bitte warten Sie einen Moment, w\u00e4hrend wir die Kontaktdaten entschl\u00fcsseln."} </script>When this happens,
ctPublicFunctionsbecomesundefined, which causes CleanTalk’s protection and form validation to fail. Context- ESI is enabled by design in our setup (WooCommerce cart, admin bar, dynamic blocks). Disabling ESI is not an option.
- With ESI enabled, we see inconsistent behavior of forms protected by CleanTalk (submissions not completing reliably).
Request
Could you please advise:
- The recommended configuration/exclusions for LiteSpeed Cache when used together with CleanTalk and ESI?
- Whether there are specific constants, defer/exclude rules, or code snippets we should apply to prevent LiteSpeed from breaking the CleanTalk script.
- If there are official steps to make CleanTalk fully compatible with LiteSpeed ESI.
We can implement custom hooks or filters if necessary.
Thank you for your support!
Best regards,
YuraThe page I need help with: [log in to see the link]
The topic ‘Compatibility Issue Between LiteSpeed Cache (ESI) and CleanTalk JavaScript’ is closed to new replies.