HTTP Request Node Timeout Error When Calling My Custom PHP API

I m trying to call my own custom PHP API using the HTTP Request node in n8n, but I keep getting a timeout error.

When I test the same endpoint using ReqBin, it works perfectly fine — so the API itself is definitely working.

I created the API for my website (code below). The issue only happens when I use n8n — it just keeps loading and eventually throws a timeout error.

Below, I’ve included both:

  • My PHP API code

  • My n8n workflow / node configuration

Could someone please help me understand why it’s timing out in n8n, even though it works with ReqBin?

Thanks in advance!


Hi @Halil,

it does indeed seem like you have a connection issue between the server where n8n is running and your PHP API. Do you use n8n Cloud or a self hosted instance. In case of the latter there could be a limitation from your hosting provider in which services you can connect to.

Can you try using another url in the http node as a test, eg. https://www.google.com/ ? And please try to reupload the n8n node configuration as I can only see a gray box below your post.

Thanks and regards

Michael

I’m using my own self-hosted server. Sorry about the confusion earlier — I didn’t paste the code properly in my first post.

When I tried sending a POST request to Google (for testing), I got the error shown in the attached screenshot.

Here’s my HTTP Request node configuration:

error screenshoot

Thanks for the additional information. Your workflow file looks fine, but the screenshot points towards the direction of a firewall preventing your self hosted instance from connecting to the internet. The issue could be in Docker (if you use that for running n8n) although by default services running inside a Docker container can connect to the internet. Another possibility would be the server that n8n is running on, maybe some restriction from your hosting provider?

What I would recommend you to do is to open up some AI tool like ChatGPT or Gemini and ask it something like this:

“I have a self hosted version of n8n running in a docker container on the hosting platform “abc” and when creating a http node connecting to an API I get a timeout. I also tried to connect to https://google.com but got an error that the connection was unexpectedly closed.”

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.