• Resolved Martin Taylor

    (@docdunning)


    Our site is broken since we updated to LS Cache V5.7. Luckily this is only in our Staging environment at the moment.

    We use ESI blocks, one of which generates the API request variables for some REST calls. Here is the PHP code:

    do_action( 'litespeed_control_set_nocache' );
    echo "\n<script id='my-api-request-vars'>";
    echo 'var myApiSettings = {"root":"', esc_url_raw( rest_url() ), '","nonce":"', wp_create_nonce('wp_rest'), '"}';
    echo "</script>\n";

    Using V5.6, we get the correct result in the HTML page:

    <script id="my_api_request_vars">var myApiSettings = {"root":"https://mysite.com/wp-json/","nonce":"162be98b4d"}</script>

    But using V5.7, the nonce generated is just the HTML comment from the plugin, which causes JS errors in the browser:

    <script id="my_api_request_vars">var myApiSettings = {"root":"https://mysite.com/wp-json/","nonce":"<!-- Block cached by LiteSpeed Cache 5.7 on 2023-10-24 13:32:15 -->"}</script>

    We need help to get this corrected, so that V5.7 behaves correctly, like V5.6 does.

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support qtwrk

    (@qtwrk)

    please create a ticket by mail to support at litespeedtech.com with reference link to this topic , we will investigate further.

    Thread Starter Martin Taylor

    (@docdunning)

    @qtwrk, Thanks, I have done that.

    I experienced the same problem, the value of my nonce field being filled with a comment instead of the nonce value.

    <input id="fictioneer-nonce" name="fictioneer_nonce" type="hidden" value="
    <!-- Block cached by LiteSpeed Cache 5.7 on 2023-10-27 01:13:53 -->
    <!-- X-LiteSpeed-Cache-Control: public,max-age=28800,esi=on -->
    <!-- Full varies: +webp -->
    <!-- X-LiteSpeed-Tag: 62b_HTTP.200,62b_HTTP.301,62b_ -->
    <!-- Object Cache  [total] 1818 [hit_incall] 1660 [hit] 56 [miss_incall] 13 [miss] 89 [set] 84 -->">

    After I updated to 5.7.0.1, the issue was gone. For now. I just leave this here in case the patch did not actually fix anything about this since the changelog does not mention it. It also did not happen for all user roles, apparently. Or always, for that matter, as it occurred for the first time yesterday. Which is weird in its own way, though.

    • This reply was modified 1 year, 1 month ago by tetrakern.
    Thread Starter Martin Taylor

    (@docdunning)

    @tetrakern – thanks for posting. I didn’t know that a new version 5.7.0.1 had been released. I’ll try it out on our Staging site.

    Edit: I have just tried 5.7.0.1 and it hasn’t fixed the problem ??

    "nonce":"<!-- Block cached by LiteSpeed Cache 5.7.0.1 on 2023-10-27 11:08:57 -->"

    Plugin Support Hai Zheng?

    (@hailite)

    Correct, v5.7.0.1 doesn’t have ESI related changes.

    We tried to reproduce the issue but failed. Do you mind to submit a ticket so we can have a further investigation?

    Thread Starter Martin Taylor

    (@docdunning)

    @hailite

    Was that request for me, or for @tetrakern ?

    I already sent an email to your support address about the problem I have.

    Thread Starter Martin Taylor

    (@docdunning)

    @hailite

    Would it help if I enable debugging in the plugin, and send you the debug log by email?

    I have sent an email to your support, referencing this ticket, with the LiteSpeed Logs attached. This should be from the time when the error still occurred. I also submitted a report from the plugin.

    The issue persisted for guests (and apparently subscribers) until I updated the plugin to the latest version. Clearing the cache did not work. For now, everything does seem to work.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Creating nonce does not work in version 5.7’ is closed to new replies.