Bobcares

curl (52) empty reply from server – Different causes and fixes

by | Jul 29, 2020

curl (52) empty reply from the server occurs when the libcurl doesn’t receive any response from the server after it sends off its request.

Here at Bobcares, we have seen several curl-related issues as part of our Server Management Services for web hosts and online service providers.

Today we’ll take a look at the cause for this error and how to fix it.

Know more about curl (52) empty reply from server

The error “empty reply from server” indicates that a zero-length response was received. This means no HTTP headers or content, simply a closed TCP connection with no HTTP payload is transmitted.

curl: (52) Empty reply from the server is a server-related issue. However, this happens when libcurl does not receive any response from the server even after it has sent off its request.

For instance, the error appears as below.

curl (52) empty reply from server

Here, we need to troubleshoot this error from the server-side and not from the client-side. Also, ‘Empty response’ is different from ‘no response’. Empty response means you are getting a reply that does not contain any data.

Causes and Fixes for curl (52) empty reply from server

Now, let’s discuss the different causes and fixes provided by our Support Engineers.

Cause 1: Using a very old version of libcurl

Using a very old version of libcurl. Libcurl is the underlying library that powers the curl command-line tool. Furthermore, it is responsible for handling the HTTP/HTTPS requests and responses.

Fix: In this case, we suggest customers upgrade the version of libcurl

Here’s how to accomplish that:

  1. If the libcurl library is installed as a system package we can update the package to the latest version using the system’s package manager.
  2. If the libcurl library is statically linked or bundled with the application, we may have to rebuild the application using a newer version of the libcurl library.
  3. Some software distributions or vendors may provide pre-compiled binaries that include the latest version of libcurl, which can be used instead of the outdated system-provided version.

Cause 2:Network or Firewall related issues

The “curl (52) empty reply from server” error can also be due to network or firewall-related issues. In case there are restrictions or configurations in the network or firewall that prevents the curl command from successfully communicating with the server, it will lead to an “empty reply from server” error.

Fix: To fix this we have to check the firewall rules and ensure that the necessary ports and services are enabled. This involves these steps:

  1. First, identify the specific ports and protocols (e.g., HTTP, HTTPS) that the server is using to communicate.
  2. Then, examine the firewall rules to ensure that the identified ports and protocols are allowed to pass through the firewall.
  3. If the necessary ports and services are not enabled, update the firewall rules to allow the required traffic.

Cause 3: website cannot complete a loopback request in WordPress

To run scheduled events, we use Loopback requests. Also, it is used by the built-in editors for themes and plugins to verify code stability.

When the loopback request fails, it means features relying on them are not currently working as we expect. However, this happens if the loopback request is disabled.

Fix: We suggest adding the below code to the “wp-config.php” file and save it.

define(‘ALTERNATE_WP_CRON’, true);

This code will use the alternative Cron job system that can solve the problem generally.

Cause 4:Curl is not listening on the correct port

The error may be because of using curl with a port assignment in the URL

For example, if we run a command like curl http://example.com:8080, and the server is not actually listening on port 8080, we will run into the “curl (52) empty reply from server” error.

Fix: We suggest using a different port

If we are unsure of the correct port to use, we can try the standard HTTP (80) and HTTPS (443) ports. These are the most commonly used ports for web servers.

For example, we can try these commands:

curl http://example.com
curl https://example.com

Cause 5:Server is set up only to accept HTTPS connections

Many websites and web servers are configured to use the HTTPS protocol. It offers an encrypted and secure connection between the client and the server.

If the server is set up to accept only HTTPS connections, and the curl command uses the plain HTTP protocol, the server will not respond. This results in the “empty reply from server” error.

Fix: In this case, we suggest using HTTPS instead of HTTP.

For example, if the original command was:

curl http://example.com

Instead, we can try this command:

curl https://example.com

Cause 6: Server redirection

If the curl command is not handling these redirects, it can result in the “empty reply from server” error. This can happen if the server is configured to redirec0t the request to a different URL, but the curl command is not following the redirect.

Fix: Here, we try executing the command using curl -L

For example, if the original curl command was:

curl http://example.com

Instead, we can try this command:

curl -L http://example.com

By adding the -L flag, curl will automatically follow any redirects that the server sends. This helps resolve the “empty reply from server” error.

[Need any further assistance in fixing curl errors? – We’re available 24*7]

Conclusion

In short, this error occurs when the libcurl doesn’t receive any response from the server after it sends off its request. Today, Our Support Experts demonstrated how to solve this curl error.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

2 Comments

  1. Joel Baliguat

    good day! please help me to fix this concern on my personal gadgets. i can’t access the web page. hope this will credits your attention to those need help. asap

    ^ “cURL error 52: Empty reply from server (see https://curl.haxx.se/libcurl/c/libcurl-errors.html)”

    Reply
    • Hiba Razak

      Hi,
      Our Experts can help you with the issue, we’ll be happy to talk to you on chat

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie
_clck, _clsk, CLID, ANONCHK, MR, MUID, SM

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

_reb2bgeo - The visitor's geographical location

_reb2bloaded - Whether or not the script loaded for the visitor

_reb2bref - The referring URL for the visit

_reb2bsessionID - The visitor's RB2B session ID

_reb2buid - The visitor's RB2B user ID

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid
_reb2bgeo, _reb2bloaded, _reb2bref, _reb2bsessionID, _reb2buid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF