ESI nonce showing only HTML comment issue
-
My Litespeed Report # is PSDDDEHA
I have had ESI enabled for about a week because some plugins included inline javascript with nonce values. I noticed the nonce values were not changing after 24 hours (or so), and it would cause the plugin not to function. Purging all caches would fix the problem, but 24 hours later the problem would happen again.
Enabling ESI appeared to fix the problem. The nonce would regenerate as expected and the plugin worked normally.
Suddenly the inline javascript is returning a console error of Invalid or unexpected token and instead of the nonce value, this comment appears:
<!– Block cached by LiteSpeed Cache 6.1 on 2024-02-09 09:57:11 –>
This appears to happen to all nonce values that were in inline javascript – so it was breaking all instances of plugins using nonce values in inline javascripts.
When disabling ESI things appear to work again – but now the original problem occurs. After 12-24 hours the plugin stops working due to expired/cached nonce.
Another interesting behavior is when JS minification / JS deferred is enabled, there is this error in the JS console: Uncaught ReferenceError: litespeed_var_# is not defined.
The HTML comment is inserted where the nonce should be:
<script>var __litespeed_var_0__=" <!-- Block cached by LiteSpeed Cache 6.1 on 2024-02-09 09:57:11 -->";</script>
This happens anywhere there is inline javascript that includes a nonce value.
<script>var __litespeed_var_0__=' <!-- Block cached by LiteSpeed Cache 6.1 on 2024-02-09 09:57:43 -->',__litespeed_var_1__=' <!-- Block cached by LiteSpeed Cache 6.1 on 2024-02-09 09:57:43 -->',__litespeed_var_2__=" <!-- Block cached by LiteSpeed Cache 6.1 on 2024-02-09 09:57:11 -->";</script> <meta http-equiv="X-UA-Compatible" content="IE=edge" />
The page I need help with: [log in to see the link]
- The topic ‘ESI nonce showing only HTML comment issue’ is closed to new replies.