localhost:5678 is the default port of n8n, the open-source workflow automation tool. The editor runs at http://localhost:5678, and Webhook nodes receive requests on the same port at /webhook/... (production) and /webhook-test/... (test). The editor working locally is the easy part; getting Stripe, GitHub or a form provider to reach those webhook URLs is where most self-hosted n8n setups get stuck.
Start n8n on 5678
npx n8n
# or Docker
docker run -it --rm --name n8n -p 5678:5678 \
-v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n
Then open http://localhost:5678 and create the owner account.
Fix "localhost:5678 refused to connect"
- Wait for
Editor is now accessible via: http://localhost:5678. First start runs database migrations and can take a while. - Docker port mapping.
docker psmust show0.0.0.0:5678->5678/tcp. With Docker Compose, check theports:entry for the n8n service. - Secure cookie error. Opening n8n over plain HTTP on anything other than
localhost(a LAN IP, say) shows a warning about secure cookies. Use HTTPS, or for local testing only setN8N_SECURE_COOKIE=false. - Wrong port. If you set
N8N_PORT, the editor moved with it.
Free or change port 5678
# macOS / Linux
lsof -i :5678
kill -9 $(lsof -ti :5678)
# Windows
netstat -ano | findstr :5678
taskkill /PID <pid> /F
Change the port with N8N_PORT=5679 npx n8n, or in Docker keep the container port and change the host side: -p 5679:5678.
n8n test URL vs production URL
Every Webhook node has two URLs, and mixing them up is the most common n8n webhook problem:
| Test URL | Production URL | |
|---|---|---|
| Path | /webhook-test/<path> | /webhook/<path> |
| Works when | You clicked Listen for test event | The workflow is active |
| Requests accepted | One, then it stops listening | Every request |
| Shows in editor | Yes, live | In Executions |
A request to the wrong one gets a 404 "The requested webhook is not registered". Use the test URL while building, then switch the provider to the production URL and activate the workflow.
Make n8n webhooks work behind a tunnel or proxy
n8n builds the webhook URL it shows (and registers with providers, for trigger nodes like the GitHub or Stripe triggers) from its own host. Without help, that's http://localhost:5678/webhook/..., which no provider can reach. When n8n sits behind a reverse proxy or a tunnel, tell it the public address:
WEBHOOK_URL=https://n8n.example.com/
Restart n8n and the Webhook nodes show the public URL. If a reverse proxy terminates TLS, also set N8N_PROXY_HOPS=1 so n8n trusts the forwarded headers. n8n start --tunnel exists, but n8n describes it as for local development and testing only.
You can then put the whole instance on a public URL:
relay connect --name my-n8n http://localhost:5678
and set WEBHOOK_URL to the HTTPS URL it prints. Reusing the same --name keeps that URL stable, so providers don't need re-registering after a restart. This also exposes the n8n editor, so keep owner login enabled with a strong password.
Receive webhooks without exposing n8n
If you only need webhooks in, not remote access to the editor, you don't have to expose port 5678 at all. The Webhook Relay Trigger node gives each workflow a stable public URL; n8n opens an outbound WebSocket and events flow in over it. No WEBHOOK_URL, no reverse proxy and no inbound port. The same works for email with the n8n Email Trigger, and for chat apps in the WhatsApp Cloud API tutorial.
