Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Wordpress / Site Health / The REST API Error / Loopback Error

how are you? 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)

Already did:

  • I disabled all plugins.
  • I changed to the default theme.
  • I disabled CSF and ModSecurity on whm.

but without success. How can I resolve this?

like image 987
Marcos Rezende Avatar asked Oct 21 '25 09:10

Marcos Rezende


2 Answers

I encountered the same two critical issues exactly, in my local development environment.

My WordPress site with the default address 'http://localhost:8000' is running in local docker containers, after adding the extra_hosts part to the docker-compose.yml, the problem resolved.

Here is the working docker-compose.yml

version: '3.3'

services:
   db:
     image: mysql:5.7
     volumes:
       - db_data:/var/lib/mysql
     restart: always
     environment:
       MYSQL_ROOT_PASSWORD: somewordpress
       MYSQL_DATABASE: wordpress
       MYSQL_USER: wordpress
       MYSQL_PASSWORD: wordpress
   wordpress:
     depends_on:
       - db
     image: wordpress:latest
     ports:
       - "8000:80"
     restart: always
     environment:
       WORDPRESS_DB_HOST: db:3306
       WORDPRESS_DB_USER: wordpress
       WORDPRESS_DB_PASSWORD: wordpress
       WORDPRESS_DB_NAME: wordpress
     extra_hosts:
       - "localhost:172.18.0.1"
volumes:
    db_data: {}

Note that 172.18.0.1 is the default docker gateway.

like image 138
derek.z Avatar answered Oct 24 '25 00:10

derek.z


the following fixed it, same as in @derek.z, however just add to your docker-compose.yml file or Portainer stack the domain "yourdomain.com" instead of "localhost":

extra_hosts:
   - "yourdomain.com:172.XX.0.1"
 

make sure to use the exact domain name and exact docker network gateway ex. 172.18.0.1, recheck after deployment, sometimes the network gets new IP (gateway).

like image 37
Ahmed Avatar answered Oct 23 '25 22:10

Ahmed



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!