WAF blocking on certain WordPress API endpoints

Hello,

I am encountering a blockage from the application firewall (ModSecurity) on my hosting, which prevents the use of a native WordPress feature.

Every write request to the /wp-json/wp/v2/blocks route of the WordPress REST API is rejected with an HTTP 403 status code and the following response body in plain text: WAF: Request blocked by ModSecurity. This route is the one for reusable block patterns ("block patterns"), a standard WordPress feature since version 5.0.

The blockage occurs both when calling the API directly and from the WordPress admin interface, logged in with an administrator account. In the latter case, the editor shows: "The update failed. The response is not a valid JSON response." This message is a direct consequence of the blockage: the editor saves by calling this route itself, receives the firewall's text response instead of the expected JSON, and cannot interpret it.

The rule triggers on the presence of an HTML comment (<!-- ... -->) in the request body. However, the serialization format of WordPress blocks is entirely made up of HTML comments. A simple paragraph is stored like this: <!-- wp:paragraph --><p>My text</p><!-- /wp:paragraph -->. Therefore, there is no valid block content that can pass this rule: the blockage makes the feature completely unusable, not just limited.

Can the WAF settings be improved for this managed service?

I have an open ticket CS16582077 with more details, including reproduction steps, but support seems to be ignoring the ticket :sleepy_face:

If anyone from the OVH team is reading this ...

Hi @ftarp

The general firewall rules cannot be modified. Have you tried disabling the firewall to see if that fixes the issue?

Take a look at this URL

https://docs.ovhcloud.com/es/guides/web-cloud/web-hosting/multisites-activating-application-firewall

Let us know, best regards.
Sergio Turpín

There are plugins like SmartSearchWP that have added a "fallback" mechanism in recent versions, so that if a request to the REST API receives a 403, the system retries it via admin-ajax.php. In your case, you could check whether the plugin that uses the "block patterns" has a similar option, or even consider a dedicated plugin for managing patterns that doesn’t depend on the REST API.

Let me know,
Sergio Turpín

It's the Managed WordPress offering, not a web hosting service with a WordPress installed on it.

It doesn't seem like there's an option to disable the firewall.

And I'd like to avoid having to install plugins to bypass the security :wink:

Wow! In your offer, the application firewall is part of the managed infrastructure. Therefore, modifying individual ModSecurity rules or disabling the firewall for a specific site is not allowed :smirking_face:

I would recommend trying a fallback plugin or switching to another product within the broad range offered by OVHcloud.

Kind regards,
Sergio Turpín