n8n · HTTP Request node

Connection refused (ECONNREFUSED)

Short answer

ECONNREFUSED in the n8n HTTP Request node means the node reached a host but the target port has no listener, most often because of Docker networking on self-hosted n8n. Address the target by a name the container can route to, such as host.docker.internal or the Compose service name.

VerifiedLast verified

01Error text

n8n error
ECONNREFUSED

02Likely causes

  • On self-hosted n8n, Docker networking. Inside the n8n container, localhost and 127.0.0.1 point at the container itself, not at the host machine.
  • On Node.js 17 and above, localhost resolves to the IPv6 address ::1 before 127.0.0.1. If the target binds only to 127.0.0.1, the IPv6 attempt is refused.
  • On n8n Cloud, there is no localhost and no path to a service on your machine.

03How to fix it

  1. For a target on the host machine with Docker Desktop, use http://host.docker.internal:<port> in the URL field.
  2. For a target on the host machine on Linux, pass --add-host=host.docker.internal:host-gateway to the container, or set extra_hosts in docker-compose.yml.
  3. For a target in another container on the same Compose stack, use the service name as the hostname and the container's internal port.
  4. If the target binds only to IPv4, use http://127.0.0.1:<port> instead of localhost.
  5. On n8n Cloud, expose local-only targets through a tunnel and use the public URL.

iNotes

This is not a DNS failure, a timeout or a firewall drop. To verify the fix, run wget against the URL from inside the n8n container.

04Official documentation

Test every fix in a non-production environment before you apply it to production. See how entries are verified.

More for n8n work:Open n8n jobsn8n rates and salaries

The iPaaS Brief

Subscribe to The iPaaS Brief.

The iPaaS newsletter for the people who run integrations. From iPaaS Group.

Free. You finish on theipaasbrief.com and confirm by email.