I am trying to figure out what is causing REST-API on a WordOps site to fail. Here’s the situation:
- In Site Health test, I see the following:
The REST API is one way that WordPress and other applications communicate with the server. For example, the block editor screen relies on the REST API to display and save your posts and pages.
When testing the REST API, an unexpected result was returned:
REST API Endpoint: https://www.DOMAIN.DOM/wp-json/wp/v2/types/post?context=edit
REST API Response: (403) Forbidden
- In the error logs I see:
2024/05/13 01:44:27 [error] 5783#5783: *152 access forbidden by rule, client: 104.211.2.187, server: DOMAIN.co.nz, request: "POST /xmlrpc.php HTTP/1.1", host: "52.183.6.62:443"
2024/05/13 01:44:36 [error] 5783#5783: *154 access forbidden by rule, client: 45.88.91.240, server: DOMAIN.co.nz, request: "GET /.git/config HTTP/1.1", host: "52.183.6.62"
2024/05/13 01:52:25 [error] 5783#5783: *203 access forbidden by rule, client: 104.211.2.187, server: DOMAIN.co.nz, request: "POST /xmlrpc.php HTTP/1.1", host: "52.183.6.62:443"
2024/05/13 01:54:49 [error] 5783#5783: *211 access forbidden by rule, client: 104.211.2.187, server: DOMAIN.co.nz, request: "POST /xmlrpc.php HTTP/1.1", host: "52.183.6.62:443"
2024/05/13 01:57:51 [error] 5783#5783: *227 FastCGI sent in stderr: "PHP message: Exception: Serialization of 'Closure' is not allowed in /var/www/DOMAIN.co.nz/htdocs/wp-content/object-cache.php:2821
“Access forbidden by a rule” - I have no idea what rules the logs are referring to. Is it referring to a firewall rule, in UWF? In case it was, I have disabled UFW, but the issue persists. Site Health still shows the same problem.
So I am wondering what else has rules that would be blocking REST-API
Any suggestions or help would be much appreciated.