I’m having trouble setting up a Cloudflare tunnel to expose my self-hosted n8n instance to the internet. I need this for some API calls and redirect URLs.
The tunnel seems to be working in the Zero Trust dashboard, but it won’t connect to my localhost:5678 where n8n is running. I’ve tried:
- Using a temporary tunnel to rule out DNS issues
- Testing with a simple Python HTTP server on port 8000 (still got a 404 error)
- Connecting through a VPN to check if it’s an ISP problem
My n8n Docker container works fine with Ngrok, so I’m pretty sure the issue is with the Cloudflare tunnel setup.
Has anyone encountered similar problems? Any suggestions on how to troubleshoot or fix this? I’m out of ideas and would really appreciate some help!
I’ve experienced similar issues when trying to expose self-hosted n8n with Cloudflare tunnels. In my case, a common cause was related to the Docker network configuration. I resolved it by ensuring that the container was either using host network mode or that the ports were properly exposed in bridge mode.
Another useful step was to simplify the tunnel configuration, perhaps using a catch-all rule temporarily. It also helped to verify that n8n was set to accept connections on all interfaces. I hope this approach helps resolve the issue.
hey man, i had this same issue. turns out my router was blocking the tunnel connection. try checking ur router settings and see if theres any port forwarding or firewall rules messing things up. also, make sure ur cloudflared daemon is running and up to date. good luck!
Have you checked your firewall settings? Sometimes local firewalls can interfere with Cloudflare tunnels. I’d suggest temporarily disabling your firewall to see if that’s the culprit. Also, double-check your n8n configuration to ensure it’s listening on all interfaces (0.0.0.0) rather than just localhost.
Another thing to consider is your Cloudflare tunnel config. Make sure you’re using the correct ingress rules and that the local service address matches your n8n setup. You might want to try running cloudflared with verbose logging to get more insight into what’s happening during the connection process.
If all else fails, you could try setting up a reverse proxy like Nginx in front of n8n. This sometimes helps resolve odd connectivity issues with Cloudflare tunnels.