
Gutenberg is the latest editor being rolled out with WordPress 5 as the default option. Some users who are using reverse proxies or Cloudflare for security reasons are facing an issue where they are not able to update their posts. The error returned by WordPress on the screen is "Updating Failed".
WordPress 5.0 "Updating failed" error in Gutenberg
We have diagnosed this error for some of our clients and fixed the issue. Here we will explain what causes this problem and how to fix it.
This problem occurs because of issues with cookie validity and cross-origin requests. There can be many reasons for this, but in our case, we were using Varnish cache and were stripping cookies for all requests except for wp-admin and wp-login. We added wp-json to the exception list and it fixed the error.
if (req.url !~ "^/wp-(login|admin|json)") {
unset req.http.cookie;
}
As in our case requests with wp-json were being cached, WordPress was sending the following error with a forbidden 403 error code:
{"code":"rest_cookie_invalid_nonce","message":"Cookie nonce is invalid","data":{"status":403}}
In your case, it could be the same error or it could be because of cross-origin issues. WordPress might be sending requests on a TLD with www or without www which does not have an active cookie. Alternatively, it could be related to SSL configuration: if WordPress is configured using HTTPS, it might be sending AJAX requests to the website on HTTP. If you are using Cloudflare and using flexible SSL, you should change it to full SSL and install SSL on your origin server.
There is also a possibility that ModSecurity is blocking your request.


