Run n8n Locally for Free with Docker (Part 7 of 10): Testing Webhooks Locally with a Free Tunnel
By Abhishek Patoliya · 2026-08-12
This is Part 7 of the series on running n8n locally with Docker for free. Everything so far has worked because you were triggering workflows manually or on a schedule, from the same machine n8n runs on. The moment a workflow needs to react to a webhook from a CRM, a form tool, or any external API, that external service needs a way to actually reach your machine — which localhost can't do from the outside. This part covers a free tunnel that solves exactly that, for testing purposes.
← Back to the full series index
Why localhost Doesn't Work for Incoming Webhooks
http://localhost:5678 only means "this machine" to processes running on that same machine. A server elsewhere on the internet trying to send a webhook has no way to resolve or route to it. A tunnel creates a public URL that forwards incoming traffic back to your local port, making your local n8n instance reachable from anywhere for as long as the tunnel is running.
Option 1: ngrok (Simplest to Start)
Install ngrok, then with your n8n container already running on port 5678:
ngrok http 5678
ngrok prints a public URL like https://random-string.ngrok-free.app that forwards to your local n8n. Without a free account, this URL changes every time you restart ngrok; a free account with a reserved domain keeps it stable across restarts.
Option 2: Cloudflare Tunnel (Free, No Account Required for Quick Tests)
cloudflared tunnel --url http://localhost:5678
This prints a similar temporary public URL. If you own a domain already on Cloudflare, you can set up a named, persistent tunnel instead of a temporary one — useful if you want a URL that doesn't change every session.
Pointing n8n at the Tunnel
Once you have a tunnel URL, n8n needs to know about it so the webhook URLs it generates inside the editor are correct. Update your docker-compose.yml environment block from Part 6:
environment:
- N8N_ENCRYPTION_KEY=your-generated-key-here
- GENERIC_TIMEZONE=America/New_York
- TZ=America/New_York
- N8N_HOST=your-tunnel-url.ngrok-free.app
- WEBHOOK_URL=https://your-tunnel-url.ngrok-free.app/
- N8N_PROTOCOL=https
Apply it with docker compose up -d, then open a workflow with a Webhook trigger node — the "Production URL" it shows should now use your tunnel's address instead of localhost.
Testing It End to End
- Add a Webhook trigger node to a test workflow and activate the workflow.
- Copy the production webhook URL n8n shows.
- From another machine, or a tool like Postman, send a request to that URL.
- Confirm the workflow execution shows up in n8n's execution log — if it does, an external request just successfully reached your local machine through the tunnel.
Safety Notes for a Free Tunnel
- Close it when you're done testing. A running tunnel exposes whatever's on that port to anyone with the URL — don't leave it running indefinitely.
- Don't tunnel an instance with production credentials without additional access controls (n8n's basic auth settings, at minimum) — free tunnel URLs offer no authentication of their own.
- Expect the URL to change on the free tier unless you've reserved a domain, which means updating
N8N_HOST/WEBHOOK_URL again each session.
Next Up
Continue to Part 8: Installing Community Nodes, which extends your local instance beyond n8n's built-in node library.
Written by Abhishek Patoliya, Senior n8n Developer & Automation Architect, Surat, India. Verified n8n Creator.