SOCKET HANG UP - Request to third party JSON REST API failes with Status Code 400 - Bad Request - reason: socket hang up

  • The Problem:
    My API Requst to to the DHL API does not work In my selfhosted instance of retool I get a Status Code of 400 - Bad Request and reason socket hang up as response. All my other API Calls work. I have some with POST,GET,DELETE. The exact same call works in the free retool cloud. Only on my selfhosted retool instance it doesn't.

  • Goal:
    Get a Response of status code 200 ok and a json response body

  • Steps:
    This call uses a Authorization header and a api key header. I tried moving them to the query instead of having it at the resource this didnt change anything.
    Its a POST request and the body has deeply nested keys. Therefore I am using a raw type of json body with variables. I tried once to hardcode everything and remove any variable but this also didnt work. Same error.
    Since it works in the free retool cloud it must be a problem with selfhosting but I dont get what causes this error.

  • Details:
    This is a example of the same call in Nodejs from Postman which works in Postman and on a nodejs server:

    Here is a link to the official documentation:
    [DHL Parcel DE Shipping (Post & Parcel Germany)](https://DHL API Documentation)

  • Screenshots:
    Screenshot of the DHL API Ressource:

    Screenshot of the Query:

  • App json export: I have attached a simplified version of my app. Since I cannot export ressources its not possible to use without creating a ressource. Check the screenshots.
    DHL.json (8.9 KB)

Hi @ben10,

Is there firewall around your server that may block the outbound requests? Or do you happen to use an air-gapped deployment of Retool?

If this would be the case why would some request work and others don't? Does not make sense...
I used the docker installation without workflows as described here Deploy Self-hosted Retool with Docker Compose | Retool Docs
I use a cloud hoster and did not setup a firewall but I can create one.
Which ports should be open?

Hey Harry,
I still have this problem and really need to implement this API.
I imported their YAML file to make sure I dont make any mistakes but same error.

request to failed, reason: socket hang up"

I tried this test call to as documented here and it worked status code 200.

The only active Firewall rule is non-standard ports are disabled by default. I can open any of these ports but I checked the docs and didn't see any hints on special ports.

Anything I can do or test?


@ben10 Yeah, I don't think there is any issue with your query per se, because you mentioned the same query works on Cloud. I still think there is something with your self-hosted set up, although I don't know what it is. Here are a few questions to troubleshoot:

  • Are the API calls to the the same resource works?
  • If you login to the self-hosted server and make a CURL call, does it work?

I tried the exported app and hit unauthorized request, which is expected. You can use the API Request tab to verify the query being sent.

I also found a DHL customer ticket here that suspect DHL server blocking user requests. You may want to ask for support from DHL's team


Thanks Harry.
I tried curl and had the same OpenSSL Error. Since Python3 is installed I tried a couple of requests in the shell with python and I got ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response')) for every endpoint.
Maybe DHL is blocking my IP as well. I have created a ticket for the issue with DHL API Support.
I will update this post accordingly.

Yeah! It looks like the request is blocked from the DHL side.