Hello everyone! As the title implies, I have an issue (probably) with the n8n http request node. I am using Windows and Docker desktop. I have two containers, n8n and one for example, image: nginx:alpine. I am trying to make a http get request from n8n workflow to the nginx. If I use host.docker.internal as the hostname, it runs forever and at some point it says timeout. If I use localhost as the hostname, I get connection refused. I have tried putting them in the same docker compose file, nothing happened. Tried putting them in the same network, the same. With both using “host” and “bridge”. I forgot to mention that if I type localhost:80 in my browser I get a fully functional nginx page. Also I spawned terminals in each containers and they can ping each other. From the n8n container, using the command : wget http://web, I get the page from nginx. I have put web as the hostname of the nginx. Tried also http://web on the request in http node in n8n, again I got nothing in return. Only “The connection was aborted, perhaps the server is offline”. I have deleted and reinstalled the containers like 8 times.
The name of the container is the right way to go about referring to another container’s service, if your containers are on the same docker network, which from your explanation sounds like they are (web resolves from n8n container).
Would you like to share your docker-compose.yml (please make sure no passwords or secrets are mentioned)?
services:
web:
image: nginx:alpine
container_name: web
hostname: web
ports:
- "8080:80" # external port mapped to 80 inside
networks:
- localnet
n8n:
image: n8nio/n8n
container_name: n8n
hostname: n8n
ports:
- "8686:5678"
environment:
- N8N_BASIC_AUTH_ACTIVE=true
# N8N_BASIC_AUTH_USER=
# N8N_BASIC_AUTH_PASSWORD=
depends_on:
- web
networks:
- localnet
networks:
localnet:
driver: bridge
Also I made a new simple docker container that has a webpage with a text box that you can put hostname/ip address and port and can curl. From there, I get normal communication hitting the http://n8n:5678/healthz. But n8n http request node cannot communicate with the webpage. So I assume my n8n’s http request node has a problem communicating with all the other containers.
You’ll need to use http://web:8080 since you’re forwarding the ports. What exactly is your use case for trying to call a seemingly empty nginx instance?
I realized the problem was that n8n could not communicate with the other containers, so I set up a dummy webpage to do tests there. I finally found the problem, I had a running n8n container in wsl which I could not find with docker ps neither from windows nor wsl. I found it when I searched for the process listening to the port 5678. So much frustration for such a stupid thing. It was weird because n8n was running without any container . And as long as Docker Desktop was open, n8n was running. After this, everything worked fine. Thank you guys for you time!
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.