0

I've been working on a site for a client for a few months now and recently I noticed that the Health Check functionallity added on the newest versions of WordPress is reporting two errors about the Rest API and loopback connections. On both errors it says connection refused, the thing is the site works fine and also I can query the API via Postman and it will work. This is the complete error:

Error: [] stream_socket_client(): unable to connect to ssl://example.com:443 (Connection refused)

As I said, the site works fine over HTTPS. Port 80 is redirected to HTTPS too.

The web is running on Ubuntu Server with kernel Linux 4.4.0-81-generic x86_64, PHP version is 7.2.14, Apache2, MySQL, 512MB of limit memory for PHP and WordPress running 5.2.2 version.

On the Apache error.log file I can see the following errors:

[Thu Jul 25 14:00:10.250021 2019] [authz_core:debug] [pid 38327] mod_authz_core.c(809): [client myPublicIP:52352] AH01626: authorization result of <RequireAny>: granted, referer: https://example.com/wp-admin/site-health.php
[Thu Jul 25 14:00:10.361701 2019] [ssl:debug] [pid 38327] ssl_engine_kernel.c(354): [client myPublicIP:52352] AH02034: Subsequent (No.5) HTTPS request received for child 6 (server example.com:443), referer: https://example.com/wp-admin/site-health.php
[Thu Jul 25 14:00:10.361884 2019] [authz_core:debug] [pid 38327] mod_authz_core.c(809): [client myPublicIP:52352] AH01626: authorization result of Require all granted: granted, referer: https://example.com/wp-admin/site-health.php
[Thu Jul 25 14:00:10.361891 2019] [authz_core:debug] [pid 38327] mod_authz_core.c(809): [client myPublicIP:52352] AH01626: authorization result of <RequireAny>: granted, referer: https://example.com/wp-admin/site-health.php
[Thu Jul 25 14:00:11.616277 2019] [ssl:info] [pid 36694] (70014)End of file found: [client 195.76.100.2:52351] AH01991: SSL input filter read failed.
[Thu Jul 25 14:00:11.616316 2019] [ssl:debug] [pid 36694] ssl_engine_io.c(1017): [client 195.76.100.2:52351] AH02001: Connection closed to child 11 with standard shutdown (server example.com:443)
[Thu Jul 25 14:00:13.336206 2019] [ssl:info] [pid 36691] (70007)The timeout specified has expired: [client myPublicIP:52361] AH01991: SSL input filter read failed.
[Thu Jul 25 14:00:13.336355 2019] [ssl:debug] [pid 36691] ssl_engine_io.c(1017): [client 195.76.100.2:52361] AH02001: Connection closed to child 8 with standard shutdown (server example.com:443)
[Thu Jul 25 14:00:15.424427 2019] [ssl:info] [pid 38327] (70007)The timeout specified has expired: [client myPublicIP:52352] AH01991: SSL input filter read failed.
[Thu Jul 25 14:00:15.424573 2019] [ssl:debug] [pid 38327] ssl_engine_io.c(1017): [client 195.76.100.2:52352] AH02001: Connection closed to child 6 with standard shutdown (server example.com:443)

The virtual host config is the following:

<IfModule mod_ssl.c>
        <VirtualHost _default_:443>
                ServerAdmin webmaster@localhost

                ServerName example.com

                DocumentRoot /var/www/html

                LogLevel debug

                ErrorLog ${APACHE_LOG_DIR}/error.log
                CustomLog ${APACHE_LOG_DIR}/access.log combined

                SSLEngine on

                SSLCertificateFile /etc/apache2/ssl/certificate.pem
                SSLCertificateKeyFile /etc/apache2/ssl/private.key
                SSLCertificateChainFile /etc/apache2/ssl/intermediate.pem

                <FilesMatch "\.(cgi|shtml|phtml|php)$">
                                SSLOptions +StdEnvVars
                </FilesMatch>
                <Directory /usr/lib/cgi-bin>
                                SSLOptions +StdEnvVars
                </Directory>

        </VirtualHost>
</IfModule>

A few weeks ago it was working fine. Also Simple History plugin stopped working because it cannot connect with the API.

Let me know if any more details are needed to help me solve the issue.

Thanks in advance guys!

  • Does example.com resolve to localhost from your server, i.e. is it in /etc/hosts as 127.0.0.1? Are you listening on port 443 on 127.0.0.1? – Rup Jul 25 at 19:00
  • @Rup example.com was just an example to not put neither the real public IP nor the domain name. As I said, everything works OK, names are been resolved, site works over HTTPS and also I can make requests to the API with Postman and they work – GuillermoG Jul 26 at 6:07
  • Yes I meant your domain name. Can you make curl or postman requests to the domain name over SSL from the server itself though? It looks like that's what's failing. And my thought is that if you try to resolve example.com on the server itself then you might be getting 127.0.0.1, not the external IP address, and the connection failure is because you are only listening on the external IP address for HTTPS traffic and not on 127.0.0.1. But I might well be wrong. – Rup Jul 26 at 6:12
  • @Rup You gave me the hint I needed to solve the issue! I just pointed the full domain name to 127.0.0.1 on the server's /etc/hosts and it worked. Before that with curl, for example, the domain resolve to the public address and this it what was causing the issue IDKW. Anyways, even though your answer wasn't exactly correct, if you wan't to write a propper answer with the solution I'll accept it! – GuillermoG Jul 26 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.