I have just created a new Bedrock websote. Its my first experience with Bedrock, so excuse me for lack of experience.
I got an issue with rest_cookie_invalid_nonce
, that disable my wp-admin area of the site. I cant edit any post, upload any media, etc.
The error is the following:
{
"code": "rest_cookie_invalid_nonce",
"message": "Cookie check failed",
"data": {
"status": 403
}
}
It happen to many files in my admin area:
I have researched about it and found several post suggesting that it is related to bedrock
.
Older posts related to the subject:
- Updating failed error on Bedrock
- Rest_cookie_invalid_nonce on MultiSite Instances
- WooCommerce REST API (401 / 403)
First two posts, have not been resolved. The third one was concluded with success. I have tried to implement its solution, but without any luck.
The solution: add this to application.php
:
/**
* Use DOMAIN_CURRENT_SITE as the cookie domain. This ensures cookies and
* nonces are using the correct domain for the corresponding site. Without
* this, logins, REST requests, Gutenberg AJAX requests, and other actions
* which require verification will not work.
*/
Config::define('ADMIN_COOKIE_PATH', '/');
Config::define('COOKIE_DOMAIN', env('DOMAIN_CURRENT_SITE'));
Config::define('COOKIEPATH', '/');
Config::define('SITECOOKIEPATH', '/');
I must mention that my site sits behind GCP LoadBalancer. Usually i configure these four cookie settings, to be able to work with cookies on WP projects i run, that are located behind LB. Its the first time I encounter this problem that I have.
I also refreshed the Authentication Unique Keys and Salts, just in case that it might help, as well cleared the cache of my site, without success.
Any idea how can I resolve the rest_cookie_invalid_nonce
error?
Maybe I missed out some configuration?
Really appreciating any help offered.
Thank you!