• Hi,
    I created a custom nonce in “wp_localize_script” and use it in jQuery.
    Without ESI it expires every day (I think even 12 hours).
    I added “my-nonce-sample private” in “LiteSpeed Cache Settings -> Cache -> ESI -> ESI Nonce”. After purge got this error in front:
    Console:
    Uncaught ReferenceError: __litespeed_var_0__ is not defined

    Source:
    <script>var __litespeed_var_0__="[an error occurred while processing this directive]";</script>

    Also i added this line before my “wp_localize_script”:
    do_action( 'litespeed_nonce', 'my-nonce-sample' );

    This cause my Ajax object corrupted:
    var ajax_object = {"ajax_url":"https:\/\/domain.com\/wp-admin\/admin-ajax.php","wp_nonce":"[an error occurred while processing this directive]"};

    Report number: FSNWONNE

    What is causing this problem and how to solve this?

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

    (@qtwrk)

    Hi,

    please enable debug log , see if there is entry about ESI in the log

    Best regrds,

    Thread Starter HamidReza Abdipour

    (@abdipour)

    Yes, this section of logs related to this ESI:

    09/15/21 10:44:25.298 [xxx.xxx.33.83:57096 2 lX7] [ESI] Appended nonce action to nonce list [action] my-nonce-sample
    09/15/21 10:44:25.299 [xxx.xxx.33.83:57096 2 lX7] [ESI] param --- array (
    'action' => 'my-nonce-sample',
    '_ls_silence' => true,
    )
    09/15/21 10:44:25.299 [xxx.xxx.33.83:57096 2 lX7] [ESI] md5_string=nonceeyJhY3Rpb24iOiJwZW1pbmEtbGFuZGluZ3MtYWpheCIsIl9sc19zaWxlbmNlIjp0cnVlfQ==
    09/15/21 10:44:25.299 [xxx.xxx.33.83:57096 2 lX7] [ESI] ?? [BLock_ID] nonce [wrapper] wp_create_nonce my-nonce-sample [Control]
    09/15/21 10:44:25.299 [xxx.xxx.33.83:57096 2 lX7] <esi:include src='/landings/?lsesi=nonce&esi=eyJhY3Rpb24iOiJwZW1pbmEtbGFuZGluZ3MtYWpheCIsIl9sc19zaWxlbmNlIjp0cnVlfQ%3D%3D&_hash=03b7c625ad32951cf17ded3df8ea8cb9' as-var='1' />
    09/15/21 10:44:25.299 [xxx.xxx.33.83:57096 2 lX7] [ESI] Preserved to 0ddf77f31f9fd0db107c7a0059694d6d
    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    now this is interesting issue

    please create a ticket by mail to support at litespeedtech.com , our staff who specialized in ESI will investigate it further with you

    Best regards,

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ESI and wp nonce’ is closed to new replies.