Hey everyone,
I’m having a tough time setting up a Cloudflare tunnel for my self-hosted n8n instance. I need to expose it to the internet 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
- Setting up a simple Python HTTP server on port 8000 (still got a 404 error)
- Connecting through a VPN to check if my ISP was blocking something
Nothing has worked so far. The weird thing is, n8n works fine with Ngrok. I just swapped the Ngrok values for the tunnel ones.
Has anyone faced similar issues? Any tips on what might be causing this or how to fix it? I’m pretty stumped at this point.
Thanks in advance for any help!
I’ve been through a similar struggle with Cloudflare tunnels and n8n. One thing that helped me was double-checking the ingress rules in the Cloudflare tunnel configuration. Make sure you’ve set up a rule that explicitly maps your domain to localhost:5678.
Also, have you verified that n8n is actually listening on all interfaces? Sometimes it defaults to only listening on 127.0.0.1, which can cause issues with tunnels. You might need to adjust your n8n configuration to listen on 0.0.0.0 instead.
Another trick that worked for me was temporarily disabling my firewall to see if that was interfering. If it works with the firewall off, you can then add the necessary rules to allow the traffic.
Lastly, check your n8n logs for any connection attempts. Sometimes there are subtle issues that only show up in the logs. If you’re still stuck, posting those logs might help others spot the problem.
I encountered a similar issue when setting up my n8n instance with Cloudflare. One crucial step that’s often overlooked is ensuring your n8n configuration file (typically .env
or config.json
) has the correct base URL set. It should match the Cloudflare tunnel URL you’re using.
Another potential pitfall is mismatched protocols. If your tunnel is set to HTTPS, make sure n8n is configured to use HTTPS as well. You might need to set up SSL certificates locally if that’s the case.
Lastly, check if there are any reverse proxy settings in your n8n setup that could be interfering with the tunnel connection. Sometimes, these can cause unexpected routing issues.
If none of these solve the problem, consider temporarily exposing your n8n logs to get more detailed error information. This could provide valuable clues about where the connection is failing.
Have u tried checking ur Cloudflare Access policies? Sometimes they can block traffic even if the tunnel’s working. Also, make sure ur using the right subdomain in CF dashboard. I had issues cuz i accidentally used the wrong one lol. Double-check ur n8n config too, might be some weird port conflict.