cache – Rest API nonce is being cached
I’m building a custom Rest Api endpoint. User can call this endpoint via ajax request in the frontend together with nonce value which was created by
wp_localize_script( 'some-js', 'wpApiSettings', [ 'nonce' => wp_create_nonce( 'wp_rest' ), ], ] );
The problem is the caching plugin. In my case, I’ve used breeze.
It cache the page together with nonce value. When the nonce is expired, the page cache still have the expired nonce in it. So when the used this nonce, they receive
rest_cookie_invalid_nonce until the cached is cleared.
Is there a way to prevent this from happen?
03 weeks 2023-02-27T12:18:09-05:00 2023-02-27T12:18:09-05:00 0 Answers 0 views 0
Leave an answer