WordPress / health-check

Health Check is a WordPress plugin that will perform a number of checks on your WordPress install to detect common configuration errors and known issues.
GNU General Public License v2.0
175 stars 56 forks source link

Loopback check fails on local `*.test` websites #472

Open pryley opened 7 months ago

pryley commented 7 months ago

Feature request/bug description

Plugins fail to activate on local websites when using Herd or Laravel Valet (i.e. *.test domains) due to the Loopback sslverify check in wp_remote_get.

https://github.com/WordPress/health-check/blob/ed432ee08df367a8c1900bc470bb66d12f54cf2a/HealthCheck/class-health-check-loopback.php#L71-L73

.test is a reserved top-level domain intended for usage in software testing. It is guaranteed to never be registered into the Internet. https://en.wikipedia.org/wiki/.test

The Loopback error:

stdClass Object (
    [status] => critical
    [message] => The loopback request to your site failed, this means features relying on them are not currently working as expected.<br>Error encountered: (0) cURL error 60: SSL certificate problem: unable to get local issuer certificate
)

Screenshot:

image

A fix could be as simple as:

add_filter('https_ssl_verify',
    fn ($verify, $url) => str_ends_with(parse_url($url, \PHP_URL_HOST), '.test') ? false : $verify,
    10,
    2,
);

Related issues

https://github.com/WordPress/health-check/issues/322 and https://github.com/WordPress/health-check/issues/357

szepeviktor commented 3 months ago

Please support all four from the standard. https://www.rfc-editor.org/rfc/rfc2606.html#section-2