WordPress and Gutenberg issue with /wp-json/wp/v2 that gives 403

Hello there.

I have for a long time had issues with my WordPress site, that after some time as logged in, gives me 403 on /wp-json/wp/v2 … when I save draft, publish or updates an post using Gutenberg editor.

I can solve it by just loggin out and in again. But that will only work for some time, until I get 403 on /wp-json/wp/v2 again and once again needs to logout and login again.

As it seems, it’s due to the CF firewall causing this. I tested to disable the WAF completely and the problem dissapeared. Have tried to search for a solution, but none of them has helps out.

But adding a custom firewall rule like in the image seems to have solved it for me. But I’m not completely sure how safe this solution is? What I did was to create an firewall rule, where I bypassed the firewall if the uri path contains /wp-json/wp/v2.

Any thoughts on this? Good or bad practice? Do you perhaps have any other suggestions that could be better to try out?

Best,
Johan Linnarsson

Did you discover this by looking at the Firewall log?

If you’re on a paid plan, it might just be as simple as adjusting some of the WAF settings for WordPress.

https://support.cloudflare.com/hc/en-us/articles/200172016-Understanding-the-Cloudflare-Web-Application-Firewall-WAF-

1 Like

May I ask do you get this error while being logged in or logged out into WordPress admin dashboard?

I usually restrict this manually in a functions.php file to specific routes and the ones which I need and which my plugins use (only /users/ when I am logged in).

Maybe you are using a security plugin like Wordfence?

Have you tried adding your server IP to the IP Access Rules / Firewall Rules with the action “Allow” at Cloudflare dashboard (requests to wp-cron.php as an example could also be blocked by a Bot Fight Mode, etc.)?

I am using Classic Editor. So I cannot say it’s related to it.

I also vote for this. You can check if your own IP gets blocked or the server’s IP, and determine wheater you have to adjust a bit your CF Firewall as @sdayman already stated.

1 Like

I did not check in the firewall log. I found that this was happening in the developer tools. I’m on a pro plan, but can’ät find the logs in the dashboard? Or do I need an higher level of subsciptionplan? :slight_smile:

For searching the problem, I made try this, try that, inactivate that to see when the problem stopped :slight_smile:

I do wonder thoug what settings to adjust for WordPress. Could it be under this and just do an trial and error (activate/deactivete features until I find what’s causing it? :slight_smile:

I do get it as logged in to the wp-admin dashboard. That is where I edit, update och creat new posts :slight_smile:

I do not use any security plugins like WordFence. CloudFalre is my security only :slight_smile:

Yes i can try to allow my servers IP to the access rules /firewall rules. Great tip to try out!

Wher can I find the logs? I’m on a pro plan :slight_smile:

Thanks for your help.

I do get it as logged in to the wp-admin dashboard. That is where I edit, update och creat new posts :slight_smile:

I do not use any security plugins like WordFence. CloudFalre is my security only :slight_smile:

Yes i can try to allow my servers IP to the access rules /firewall rules. Great tip to try out!

Wher can I find the logs? I’m on a pro plan :slight_smile:

Thanks for your help.

I tried to add the IP, but that did not make the trick unfortunately. In the developer tools console i did get “Failed to load resource: the server responded with a status of 403 ()” again.

I did find the logs for the WAF :slight_smile:

This is what I get. Thanks for your help!

There are many threads on 981176 with suggestions on how to deal with it.

I’m curious to know what the WordPress Block Editor is doing to trigger the Cloudflare Firewall. Firing off a huge amount of requests to the wp-json API maybe?

A logged in and verified user editing a post shouldn’t be blocked.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.