• Resolved moorthyit

    (@moorthyit)


    Hi,

    Thanks for this great plugin. We are displaying some data as dropdown at front end through REST API call. Some users are getting the below error frequently for that API call

    {“code”:”rest_cookie_invalid_nonce”,”message”:”Cookie nonce is invalid”,”data”:{“status”:403}}

    In that rest API, we have used nonce.

    If we clears the lite speed cache, then error disappeared instantly and data is retrieving from the API. We thought it might be due to cache. Do we need to change the litespeed cache limit for ‘Default REST TTL’ ? or Do we need to do anything else?. Please let us know.

    Thanks

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

    (@qtwrk)

    Hi,

    yes, please try set REST TTL to less than 12 hours and see how it goes

    Best regards,

    Thread Starter moorthyit

    (@moorthyit)

    Hi,

    Ok. Thanks for your reply. I will set it to less than 12 hours and will update the results soon. Thanks

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    just follow up , how is it doing ?

    Best regards,

    Thread Starter moorthyit

    (@moorthyit)

    Hi,

    No issue so far. I think it is working fine now. Thanks for your support.

    Thread Starter moorthyit

    (@moorthyit)

    Hi,

    We are getting that same error again. It seems setting REST TTL to less than 12 hours doesn’t work. Can we enable ESI and put “wp_rest” into ESI nonce list? Will it work?. Please let me know. Thanks

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    you will need know what exactly is the nonce name , I don’t think wp_rest is the case here.

    Best regards,

    Thread Starter moorthyit

    (@moorthyit)

    Hi,

    We have used custom Wp-rest API to get those data through ajax call. We guess nonce name will be wp_rest for WP REST API. We have tried and enabled ESI but it doesn’t work too. For now, we have moved backed to admin-ajax instead of rest api to fix that issue temporarily.

    Still, we are searching for a solution to use rest api along with lite speed cache plugin. Thanks

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    this now sounds little weird

    if nonce is expired , regardless it’s admin-ajax or wp-json , both should returns to same error as nonce verification failed.

    if you disable WP REST cache by set TTL to 0 , how does it go ?

    Best regards,

    Plugin Support qtwrk

    (@qtwrk)

    Hi,

    I’m going to mark this topic “Resolved”, due to lack of activity.

    If you still need help, please feel free to re-open it.

    When re-open it, please also change the topic status to “not solved”

    Best regards,

    Hi,

    I’ve the same problem. Disable the cache for the Rest API does nothing. The nonce used is in the page :

    wp.apiFetch.nonceMiddleware = wp.apiFetch.createNonceMiddleware( "xxxxxxxxxx" );

    I’ve down TTL to one hour to make my site more usable but they still a problem during the last hour of nonce validity. Could there be a better solution?

    Thanks

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Getting rest_cookie_invalid_nounce error for REST API call frequently’ is closed to new replies.