Fixing the cURL error 28: Connection timed out after X milliseconds

Nadejda

· 07th January 2021·Website Maintenance

Fixing the cURL error 28: Connection timed out after X milliseconds

The cURL error 28 is a WordPress REST API problem which can be encountered on a regular basis but can still cause some issues with your website.

Today we will show you how to resolve it easy and efficiently.

What is cURL?

cURL, often called simply “curl,” is a command line tool. With the help of URL syntax it can transfer data to and from servers. Its popularity is due to the fact that it’s very flexible when completing certain tasks. It can be used for HTTP post, user authentication, SSL connections, FTP uploads, proxy support, and more. You can even download web pages and images.

Why does the cURL error 28 appear?

The reason for this error to appear is due to failure to answer back to the server’s request for data in the correct time frame.

WordPress can send and receive data requests with the help of the REST API. In the cases when these requests are timed out, you will notice the following issue: ‘The REST API encountered in error’.

cURL error 28

Another related issue which may catch your eye is:

loopback

What is the reason behind the cURL timeout?

There are a number of reasons which can cause the cURL timeout. For example, if there is an issue with your DNS server, this could lead to failed HTTP request.

Your firewall plugin might be blocking the REST API request or your hosting server might be poorly configured.

Let’s see how to properly troubleshoot and fix this error.

Disable your Firewall

You might be using a plugin or your own WordPress firewall, in which case you would need to disable it.

Disable your Firewall

Now, go to the website’s health report page. You will be able to see if the issue was resolved.

If the error has disappeared, your Firewall was the problem and you need to check which API request was blocked. This would lead you to the source of the problem, or you will need to make the proper configurations of your Firewall’ settings.

Deactivate all plugins

In the case of plu-ins, they do their own API requests in order to send out and receive data. If this process takes too long or is too frequent, this may be the source of the problem.

You can check this by going to Plugins – Installed plugins. Now select All Plugins.

Deactivate all plugins

Go to the Bulk Actions drop down menu and choose Deactivate – Apply.

Go back to the Health report and see of the problem remains. If it’s gone, you can start activating the plugins one by one in order to locate the one which is causing the issue.

Latest software for your hosting server

An important step is checking whether your hosting server is using the latest software of cURL library, PHP, and OpenSSL.

This can be seen from your system information tab Tools – Site Health.

Site Health

Click on the Info tab - Server section. You will see all relevant info about the software you are currently using.

Server section

It’s best to be using PHP 7.4.13 and higher, OpenSSL 1.1.1 and higher, and curl 7.7.4.0 and higher.

If that’s not the case, get in touch with your hosting company and ask for assistance.

SSL insecure content issue

If the configuration of your HTTPS/SSL is not done accordingly, it may lead to the cURL error 28.

In similar cases when your site is not using HTTPS/SSL, but an API call was made using an HTTPs URL, the requests will fail and the following message will appear.

SSL insecure content issue

This can be fixed by re-installing your SSL certificate.

Contact your hosting company

If all of the above fails, it’s time to call for assistance, as the problem most likely lies within the hosting environment.

A lot of elements are in the hands of your hosting company, which is why you can need to raise a ticket with them, explaining the details and the relevant team will do their best.

We hope today’s article was helpful in learning how to deal with the cURL error 28! Drop a comment bellow and tell us what you think!

Nadejda
Nadejda Milanova