n8n · HTTP Request node
Connection refused (ECONNREFUSED)
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
ECONNREFUSED02Likely causes
- On self-hosted n8n, Docker networking. Inside the n8n container,
localhostand127.0.0.1point at the container itself, not at the host machine. - On Node.js 17 and above,
localhostresolves to the IPv6 address::1before127.0.0.1. If the target binds only to127.0.0.1, the IPv6 attempt is refused. - On n8n Cloud, there is no
localhostand no path to a service on your machine.
03How to fix it
- For a target on the host machine with Docker Desktop, use
http://host.docker.internal:<port>in the URL field. - For a target on the host machine on Linux, pass
--add-host=host.docker.internal:host-gatewayto the container, or setextra_hostsindocker-compose.yml. - For a target in another container on the same Compose stack, use the service name as the hostname and the container's internal port.
- If the target binds only to IPv4, use
http://127.0.0.1:<port>instead oflocalhost. - 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
→Related errors
- Bad request - please check your parametersThis n8n HTTP Request error displays when the node receives a 400 error indicating a bad request. Review the API documentation for your service to format your query parameters.
- The resource you are requesting could not be foundThis n8n HTTP Request error displays when the endpoint URL you entered is invalid. Refer to your service's API documentation to verify you have a valid endpoint.
- JSON parameter need to be an valid JSONThis n8n HTTP Request error displays when you pass a parameter as JSON and it is not formatted as valid JSON. Test your JSON in a JSON checker or syntax parser to find errors.
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