• Resolved lemonxxl

    (@lemonxxl)


    Hi.
    I have this code on my page
    echo apply_filters( ‘litespeed_esi_url’, ‘address_cookie’, ‘Custom address cookie ESI block’ );
    In my functions.php I have this
    add_action( ‘litespeed_esi_load-address_cookie’, ‘address_cookie_esi_load’ );
    function address_cookie_esi_load()
    {
    do_action( ‘litespeed_control_set_nocache’ );
    echo $_COOKIE[‘address’];
    }

    I got value from $_COOKIE but in my code I have this
    <!–lscwp Custom address cookie ESI block –>COOKIE value<!–uncached by LiteSpeed Cache 5.4 on 2023-04-21 15:34:03 –><!–X-LiteSpeed-Cache-Control: no-cache–><!–lscwp Custom address cookie ESI block esi end —>

    I need only cookie value, without this comment tags, because I’m using this in inline JS in that page.

    Thanks
    Darko

    • This topic was modified 3 years, 1 month ago by lemonxxl.
Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Support qtwrk

    (@qtwrk)

    define( 'LSCACHE_ESI_SILENCE', true );

    please try add this

    Thread Starter lemonxxl

    (@lemonxxl)

    Hi,

    Thank you for answer. I still have this
    <!– lscwp Custom address cookie ESI block–>COOKIE<!– lscwp Custom address cookie ESI block esi end–>

    Thanks
    Darko

    Thread Starter lemonxxl

    (@lemonxxl)

    One more example
    If I use var_dump after this filter I got this
    string(242) “<!– lscwp Custom address cookie ESI block –>Zösenberg 43<!– lscwp Custom address cookie ESI block esi end –>”

    You see string length is 242. I can’t get only value.

    Plugin Support qtwrk

    (@qtwrk)

    please try add it into your wp-config.php , next line after <?php this needs to be called before the plugin finalize the output , otherwise it will be too later to silence it

    Thread Starter lemonxxl

    (@lemonxxl)

    HI.

    It didn’t help. Same thing.

    thanks
    Darko

    Thread Starter lemonxxl

    (@lemonxxl)

    Main problem is this. apply_filter back this
    <!– lscwp Custom address cookie ESI block –><esi:include src=’/?lsesi=address_cookie&_control=private%2Cno-vary&_hash=7f5dfae6c8c6dfbf8f101a41385923c0′ cache-control=’private,no-vary’ /><!– lscwp Custom address cookie ESI block esi end –>
    <esi:include src=’/?lsesi=address_cookie&_control=private%2Cno-vary&_hash=7f5dfae6c8c6dfbf8f101a41385923c0′ cache-control=’private,no-vary’ /> this back cookie value but only for show on page. I need value in variable.

    I tried to grab echo value with ob_get_contents() but still have string(242).
    Any idea?
    Darko

    Plugin Support qtwrk

    (@qtwrk)

    it looks like your server does NOT support ESI

    please check in Toolbox -> Report -> System Information -> LITESPEED_SERVER_TYPE , what’s the value of it ?

    Thread Starter lemonxxl

    (@lemonxxl)

    LITESPEED_SERVER_TYPE = LITESPEED_SERVER_ENT

    Plugin Support qtwrk

    (@qtwrk)

    did you actually see plain text “/?lsesi=address_cookie&_control=private%2Cno-vary&_hash=7f5dfae6c8c6dfbf8f101a41385923c0” in the HTML output ?

    that shows the ESI option is not enabled , and please provide the report number

    you can get it in toolbox -> report -> click “send to LiteSpeed”

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

The topic ‘ESI – litespeed_esi_url back HTML comment tag in code’ is closed to new replies.