cURL error 28

Have you received an error like these while validating your WP Rocket license, or after activating Load CSS Asynchronously?

Error: cURL error 28: Operation timed out after x milliseconds 

cURL error 28: Connection timed out after x milliseconds

A cURL error 28 is not directly caused by WP Rocket, but it's related to your site or server configuration.

Useful links: 

WordPress configuration

If the time out is 5000 milliseconds, the issue is that the default value set by WordPress isn't enough to process the request

Adding the following to your (child) theme functions.php file should help with that:

add_filter('http_request_timeout', function ($timeout) {
    $newtimeout = 10;
    return $newtimeout;
});

If the next error shows specifically 10000 milliseconds after adding the filter, incrementing the value of $newtimeout by 5 should on each test should help.

Meaning, the next test would be setting $newtimeout = 15;

Security

If you've got a firewall or any security layer on your site, it may perceive requests to and from our servers as malicious and it may block them. The result is that the connection is never made and you see the cURL error 28. 

The solution is to add our IP addresses to the allowlist in your security layer (such as Cloudflare, Sucuri, Bitninja etc), server firewall or security plugin. Please find the relevant IPs here:

Self-requests blocked

Check the WordPress Site Health tool for your site by going to Tools→ Site Health. There you will likely see related errors, like Your site could not complete a loopback request

Some hosts disallow sites hosted on their servers to connect to themselves using cURL. This can prevent several WP Rocket features, like preload and critical path CSS generation, to fail.

Please contact your host's support about this and request to remove that limitation if it’s set in the server.

Basic requirements

cURL is a PHP library that allows your WordPress install to communicate with other websites (like ours), so your server has to meet some basic requirements for cURL to work as expected: up-to-date PHP and cURL versions are needed. You can contact your hosting provider and ask them about this.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.