I have my site behind a StackPath firewall (CDN+WAF).
I am getting two errors when I use the native WordPress site health feature.
Your site could not complete a loopback request
Loopback requests are used to run scheduled events, and are also used by the built-in editors for themes and plugins to verify code stability.
The loopback request to your site failed, this means features relying on them are not currently working as expected.
Error: cURL error 35: OpenSSL SSL_connect: Connection reset by peer in connection to mydomain.com:443 (http_request_failed)
and
The REST API encountered an error
The REST API is one way WordPress, and other applications, communicate with the server. One example is the block editor screen, which relies on this to display, and save, your posts and pages.
The REST API request failed due to an error.
Error: cURL error 35: OpenSSL SSL_connect: Connection reset by peer in connection to mydomain.com:443 (http_request_failed)
How can I resolve this?
Since the site is behind a WAF firewall, there is no reason for it to go out to the WAF, and back to perform a loopback. We want it to go directly back to the server.
The solution is to modify the hosts file (/etc/hosts) to resolve each website to the origin IP address.
sudo vim /etc/hosts
Add the site in question to the origin IP address.
Example:
105.67.244.102 mydomain
That's it. The loopback error should be gone.