• Resolved JapeNZ

    (@japenz)


    Hi there,
    I’ve noticed that with ESI > Cache Admin Bar active, if I search my woocommerce website with a term that has a space in it, the admin bar is no longer visible.

    Examples of search terms used for testing:

    Absolute Batman (No Admin Bar)
    Batman (Admin Bar Visible)
    Ultimate Wolverine (No Admin Bar)
    Wolverine (Admin Bar Visible)

    Each time I run the searches that result in no admin bar I see the following in my debug log:

    ESI buffer empty /?s=Absolute+batman&post_type=product
    ESI buffer empty /?s=ultimate+wolverine&post_type=product

    Tested on staging site using Storefront theme with only Woocommerce and Litespeed Cache plugins active.

    Can you confirm if you’re also seeing the same issue, and if possible suggest a workaround / fix please?

    Thank you for your help!

    • This topic was modified 4 months, 1 week ago by JapeNZ.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Support litetim

    (@litetim)

    @japenz please send a report from the stage site and share the report ID(just the id). Thank you

    • This reply was modified 4 months, 1 week ago by litetim.
    Thread Starter JapeNZ

    (@japenz)

    Hi @litetim,

    Thank you for your help with this.
    Report sent, ID WRFBRSGU

    Plugin Support litetim

    (@litetim)

    @japenz Let’s be clear 1 thing(forum guides) stops everybody from sharing access to sites. Please do not ask/give any users or passwords.
    To test your issue there is access to site needed.
    Please create a ticket by sending an email to: support at litespeedtech.com
    In the ticket body please provide this topic link and request to be attached to a developer.

    When email is sent, please confirm that you created it, no other info needed

    Thread Starter JapeNZ

    (@japenz)

    Hi @litetim,

    Support ticket opened (Ticket Created #208917)

    Thread Starter JapeNZ

    (@japenz)

    Hi @litetim,
    Unfortunately we had to remove the staging site due to massive bot attacks, which had to be resolved before we could continue with troubleshoooting.

    I can’t seem to find a link to our support ticketr anymore though.

    Anyway as part of our code review we were able to find a fix for the litespeed issue!

    /* ============================================================================
    LITESPEED CACHE FIXES
    ========================================================================= */

    /**
    * DISABLE CANONICAL REDIRECTS FOR LITESPEED ESI
    * Detects the LiteSpeed ESI request and completely unhooks the redirect function
    * from WordPress. This guarantees the redirect loop cannot happen.
    */
    function lsc_fix_remove_redirects_for_esi() {
    // Check if this is a LiteSpeed ESI request
    // We check both the query parameter and the Header to be sure
    if ( isset( $_GET['lsesi'] ) || isset( $_SERVER['HTTP_X_LSCACHE'] ) ) {

    // Remove the standard WordPress canonical redirect
    remove_action( 'template_redirect', 'redirect_canonical' );

    // Safety: If an SEO plugin is forcing it, try to disable that too
    add_filter( 'wpseo_canonical', '__return_false' ); // Yoast
    }
    }
    // Run on 'init' which happens before the redirect logic is triggered
    add_action( 'init', 'lsc_fix_remove_redirects_for_esi' );

    Seems to have done the trick.

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

You must be logged in to reply to this topic.