• Resolved Hlsg

    (@hlsg)


    Your docs suggest that the plugin will auto treat WP’s default nonces as ESIs:

    If your plugin uses a default nonce, then LiteSpeed Cache will automatically treat that nonce as an ESI block.

    However, this does not seem to be the case with wp_logout_url(), which I’m using to add a logout link for logged in users to the main menu of a site. With the pages beeing cached, the first logout attempt works, but upon logging in again, the second log out attempt fails with WP’s “Are you sure..” warning.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Sorry that the nonce creation wp_logout_url() is not adaptable with our auto ESI nonce conversion, please follow this instruction to convert the whole button you created to ESI. Please feel free to let us know if you have any question on converting the script.

    Thread Starter Hlsg

    (@hlsg)

    Thank you for the resource. I’ve managed to get this working, but not really. The functionality is there, but the plugin adds a comment which invalidates the nonce:

    wp-login.php?action=logout&_wpnonce=da9312sdas<!-- Block generated by LiteSpeed Cache 2.9.9.2 on 2019-12-16 02:23:03 -->

    I’ve also become aware that this particular issue with wp_logout_url can also be solvedes by simply adding if ( class_exists('LiteSpeed_Cache_API') ) LiteSpeed_Cache_API::nonce_action('log-out'); before the call, but I would prefer to do it like in the resource you provided since I have other blocks I want to use as ESIs andit’s better if I wrap my head well around your API.

    Thread Starter Hlsg

    (@hlsg)

    Please disregard m previous comment. It’s all good.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Plugin fails to treat default WP nonce as ESI’ is closed to new replies.