Tunnel return 504 Gateway Timeout on localhost with docker

Hello here :slight_smile:

I am running into an issue with my local n8n setup using Docker on macOS. I have deployed n8n in a Docker container and am using the --tunnel option to create a tunnel for webhooks. However, when I try to send a webhook through the tunnel, I receive a “504 Gateway Timeout” error.

Docker Run Command:
docker run -it --rm --name n8n -p 5678:5678 -e N8N_TUNNEL_SUBDOMAIN=my_tunnel_subdomain -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n start --tunnel

Details:

  • n8n version: 1.42.1
  • Database (default: SQLite): default
  • n8n EXECUTIONS_PROCESS setting (default: own, main): I don’t know what it is
  • Running n8n localy with: Docker 26.1.1, build 4cf5afa (official n8n docker image)
  • Operating system: MacOS Sonoma 14.4.1

Despite setting the N8N_TUNNEL_SUBDOMAIN to my_tunnel_subdomain, the tunnel URL assigned is different, and I consistently get a “504 Gateway Timeout” error when trying to send webhooks.

I have tested on my WiFi network and an iPhone hotspot, but the problem is the same.

Logs:
Failed to renew license: renewal failed because current cert is not initialized
Error: connection refused: hooks.n8n.cloud:42617 (check your firewall settings)

I would greatly appreciate any guidance or suggestions on how to resolve this issue. Is there a specific configuration I might be missing or any known issues with using the tunnel option in Docker on macOS?

Thank you in advance for your help!

1 Like

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I’m guessing this is an upstream issue of:

Failed to renew license: renewal failed because current cert is not initialized
Error: connection refused: hooks.n8n.cloud:42617 (check your firewall settings)

Which means n8n could not verify the license (even if its free I believe). I saw some recommended solutions of restarting, changing different env vars if you are reverse proxying for example. Or trying an upgrade.

This could also be related to docker directly. I was working with a client that wanted large high-availability setups on MacOS devices only. It was crazy difficult because docker does not correctly forward ports to the main host (on macos only), as it uses a virtualized host, causing TONS of issues. Nearly every solution, including kubernetes, had lots of issues communicating both outside of their sandboxes, to their own host, and to each other.

You should also double check your firewall, allow the hooks port.

Justin - thinkbot.agency

Hi Justin,

Thank you for your response. I tested the npm installation locally, and the tunnel works perfectly. This confirms that the issue lies with Docker and not my firewall.

I suspected it might be a port forwarding problem within Docker. Is there a known solution for this issue on macOS? I haven’t found anything so far…

Edit: The npm install tunnel command worked for a few minutes, but then I encountered an HTTP ERROR 408. This isn’t a timeout issue like with Docker.

Honestly, I’m starting to lose patience with n8n. I also tried installing it on Render, but due to a suspicious warning, my Render account got blocked. (but this is another issue)

Workaround: Using ngrok with the environment variable WEBHOOK_URL works perfectly on both Docker and the npm version.

This is a significant issue with n8n, which makes me somewhat concerned about the app’s reliability.

Thanks for your help.

1 Like

Hey @damienp199,

When using the tunnel you shouldn’t set the N8N_TUNNEL_SUBDOMAIN option, It sounds like you have nailed it and it is likely something to do with the Docker configuration maybe the Docker network is set to host only or something although it is an outbound tunnel so that should work.

We will likely be removing the tunnel option in the future with a preference towards ngrok or Cloudflare tunnels as while the tunnel is handy for testing it can have it’s issues if the connection is dropped.

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