• Resolved faradei

    (@faradei)


    Hi LiteSpeed team,

    I found a reproducible issue with LiteSpeed Cache for WordPress.

    Environment:

    • WordPress 6.9.4
    • LiteSpeed Cache 7.8.1
    • OpenLiteSpeed
    • ESI enabled
    • Admin Bar ESI enabled
    • Logged in as administrator
    • Page Optimization -> Tuning -> Role Excludes includes: administrator

    Issue:
    When the administrator role is excluded from Page Optimization, the comment form is duplicated on posts with comment_form() output.

    In the page source, the original comment form remains wrapped in:

    and the ESI-rendered comment form is also inserted after:

    If I remove administrator from Page Optimization -> Tuning -> Role Excludes and purge cache, the duplication disappears.

    Expected result:
    The original wrapped comment form should be removed, leaving only the ESI-rendered comment form.

    Possible cause:
    It looks like when the current role is in optm-exc_roles, LiteSpeed Cache defines LITESPEED_NO_OPTM = true. Then Core::send_headers_force() skips the litespeed_buffer_finalize filter.

    However, LiteSpeed\GUI::finalize() is hooked to litespeed_buffer_finalize and calls _clean_wrapper(), which removes the “LiteSpeed To Be Removed” blocks.

    So ESI still inserts the comment form, but the wrapper cleanup is skipped when optimization is disabled for the current role.

    Relevant code:

    • src/core.cls.php: LITESPEED_NO_OPTM is set for roles in optm-exc_roles
    • src/core.cls.php: litespeed_buffer_finalize is skipped when LITESPEED_NO_OPTM is true
    • src/gui.cls.php: GUI::finalize() calls _clean_wrapper()
    • src/esi.cls.php: comment form ESI wraps original output with GUI::clean_wrapper_begin/end

    It seems the ESI cleanup should still run even when Page Optimization is disabled for a role, since this cleanup is required for ESI output correctness.

    Thanks!

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Support litetim

    (@litetim)

    @faradei OpenLitespeed does not support ESI.
    ESI is available only on Litespeed Enterprise.

    Thread Starter faradei

    (@faradei)

    Hi @litetim ,

    Thanks for the reply.

    I understand that OpenLiteSpeed itself does not support ESI at the server level. However, my setup uses QUIC.cloud CDN, and according to the LiteSpeed documentation, ESI is supported via QUIC.cloud CDN as well as LiteSpeed Enterprise / LiteSpeed Web ADC.

    So in this case I’m not expecting OpenLiteSpeed itself to process ESI. The ESI functionality is enabled through LiteSpeed Cache + QUIC.cloud.

    The issue I’m reporting appears to be in the LiteSpeed Cache for WordPress plugin logic: when the administrator role is excluded in Page Optimization -> Tuning -> Role Excludes, the original comment_form() output remains wrapped in the “LiteSpeed To Be Removed” block, while the ESI-rendered comment form is also inserted, causing duplication.

    If I remove administrator from Role Excludes and purge cache, the cleanup works and the duplicate form disappears.

    Could you please check whether the ESI cleanup via GUI::finalize() / _clean_wrapper() should still run even when Page Optimization is disabled for the current role?

    Thanks!

    Plugin Support litetim

    (@litetim)

    @faradei Ok, if you use CDN then it should work(that was not clear from first message).
    Let me do some tests and see the result.

    Plugin Support litetim

    (@litetim)

    @faradei please send me 2 more data:
    – tell me if you do the tests as logged in as admin user type
    – send a report to Litespeed and share the ID generated. Follow this guide: https://docs.litespeedtech.com/lscache/lscwp/troubleshoot/#get-a-report-number

    Thread Starter faradei

    (@faradei)

    @litetim yes as admin.

    TCUSEXWM

    Thread Starter faradei

    (@faradei)

    hello? @litetim

    Plugin Support litetim

    (@litetim)

    @faradei looking into the issue.
    Be back with updates

    Plugin Support litetim

    (@litetim)

    @faradei I have tested the issue and I was able to reproduce it by adding these changes to my test site with LSC https://github.com/litespeedtech/lscache_wp/pull/934/changes

    Please confirm, if you are able, that your theme or any plugins contains, in some extend, this code.
    Thank you

    Plugin Support litetim

    (@litetim)

    @faradei you’re completely right—the buffer isn’t being processed.

    Here is a quick, temporary fix for your specific situation. Please keep in mind that this is just a workaround and not the permanent solution we will implement in the upcoming version.

    You can find the lines to change here: https://github.com/timotei-litespeed/lscache_wp/commit/94a284c166b6b8b900e6ec279aa0e6217d5a169f

    We are currently working on a more robust, long-term fix for this issue. Thank you so much for your patience and for helping us debug this!

    • This reply was modified 2 weeks, 4 days ago by litetim.
    Plugin Support litetim

    (@litetim)

    @faradei a fix was added to DEV code.
    You can test it from LSC => Toolbox => Beta Test
    Click on dev then on update
    Clear cache and test the code.
    Caution: this is a dev code, there are known issue in it, but ESI part can be tested.


    This mean that the fix will be added in a future versions of LSC.

    Thank you!

    • This reply was modified 1 week, 3 days ago by litetim.
    • This reply was modified 1 week, 3 days ago by litetim.
    Thread Starter faradei

    (@faradei)

    Hi @litetim ,

    Thank you for the update and for working on a long-term fix! I’m glad the issue was successfully identified and patched. I’ll keep an eye out for the upcoming stable release.

    Thanks again for your help and great support!

Viewing 11 replies - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.