n8n · troubleshooting · tested on n8n 2.41.3, 30 September 2026
n8n webhook URL shows localhost
The Webhook node shows http://localhost:5678/webhook/… because n8n builds webhook URLs from its own configuration, not from the address in your browser. The defaults are http, localhost and port 5678. Set N8N_WEBHOOK_URL=https://your-domain/ and restart n8n. Behind a reverse proxy, also set N8N_PROXY_HOPS=1, as n8n’s reverse-proxy docs do. Two common half-fixes leave you broken in different ways: N8N_HOST alone keeps :5678 in the URL, and N8N_EDITOR_BASE_URL alone fixes only the test URL.
What each variable does to the URL
We loaded n8n’s own URL code from n8n 2.41.3 in a clean environment and printed the base URLs it returned for each setting. These are the prefixes the editor puts in front of webhook/… and webhook-test/…:
| Environment | Production webhook base | Test webhook base | Usable behind a proxy? |
|---|---|---|---|
(nothing set) | http://localhost:5678/ | http://localhost:5678/ | No |
N8N_HOST=n8n.example.com | http://n8n.example.com:5678/ | http://n8n.example.com:5678/ | No |
N8N_HOST=n8n.example.com N8N_PROTOCOL=https N8N_PORT=443 | https://n8n.example.com/ | https://n8n.example.com/ | Yes |
N8N_EDITOR_BASE_URL=https://n8n.example.com/ | http://localhost:5678/ | https://n8n.example.com/ | No |
WEBHOOK_URL=https://n8n.example.com/ (deprecated) | https://n8n.example.com/ | https://n8n.example.com/ | Yes |
N8N_WEBHOOK_URL=https://n8n.example.com/ | https://n8n.example.com/ | https://n8n.example.com/ | Yes |
Output of n8n’s UrlService (getWebhookBaseUrl and getTestWebhookBaseUrl) on n8n 2.41.3, 30 September 2026. The row with N8N_PORT=443 shows what the variables produce; it also makes n8n itself listen on port 443, which is usually not what you want behind a proxy.
The rules behind the table
- Default URL = protocol + host + portFrom
N8N_PROTOCOL(defaulthttp),N8N_HOST(defaultlocalhost) andN8N_PORT(default5678), plusN8N_PATH. The port is left out only for http on 80 and https on 443. That is whyN8N_HOSTalone giveshttp://n8n.example.com:5678/. - N8N_WEBHOOK_URL overrides both webhook URLsThe docs describe it as setting “the base URL for both test and production webhooks when running n8n behind a reverse proxy.” In the source it takes priority over everything else, for both.
- N8N_EDITOR_BASE_URL is for the editor, not production webhooksThe docs call it the “Public URL where users can access the editor”. In 2.41.3 the test webhook URL falls back to it, but the production URL does not. It stayed
http://localhost:5678/in our run. Test runs succeed, and the published workflow gives out a localhost URL. - WEBHOOK_URL still works, with a warningDeprecated from 2.35.0 per the docs. At startup, 2.41.3 printed
WEBHOOK_URL -> Use N8N_WEBHOOK_URL instead, which sets the base URL for both test and production webhooks.
The fix, from n8n’s reverse-proxy docs
export N8N_WEBHOOK_URL=https://n8n.example.com/
export N8N_PROXY_HOPS=1 In Docker Compose the same two go under the n8n service’s environment:. The docs also ask the last proxy on the path to pass X-Forwarded-For, X-Forwarded-Host and X-Forwarded-Proto. Without N8N_PROXY_HOPS, n8n will log the X-Forwarded-For trust proxy error as soon as those headers arrive. After changing the variables:
- Recreate the containerA plain restart keeps the old environment. Use
docker compose up -dafter editing the file, or remove and re-run the container. - Check the Webhook nodeOpen it and confirm both the Test URL and the Production URL now start with your domain.
- Re-send the URL wherever you pasted itA localhost URL already saved in Stripe, GitHub or a form builder does not update itself. For trigger nodes that register with the app when you publish, unpublish and republish so n8n sends the new address.
A localhost URL that works when you call it with curl on the server and fails for everyone else is this problem. A URL that answers 404 “The requested webhook … is not registered” is a different one: the workflow is not published. See webhook not registered.
Sources and last verified
URLs computed with n8n 2.41.3’s own code on 30 September 2026; every doc quote was read on the same day. If n8n’s docs and this page disagree, n8n wins. Write to support@flowtemplates.app and we will re-verify.
- n8n Docs — Configure webhook URLs with reverse proxy — checked 2026-09-30
- n8n Docs — Endpoints environment variables (N8N_WEBHOOK_URL; WEBHOOK_URL deprecated from 2.35.0) — checked 2026-09-30
- n8n Docs — Deployment environment variables (N8N_HOST, N8N_PORT, N8N_PROTOCOL, N8N_EDITOR_BASE_URL) — checked 2026-09-30
- n8n source — url.service.ts (how the webhook base URL is built) — checked 2026-09-30
Frequently asked questions
Why does my n8n webhook URL say localhost?
Because n8n builds the URL from its own settings, not from the address in your browser. With nothing configured it uses the defaults, http + localhost + 5678, so the Webhook node shows http://localhost:5678/webhook/…. That is correct inside the machine and useless to any outside service. Set N8N_WEBHOOK_URL to your public address and restart n8n.
What is the difference between WEBHOOK_URL and N8N_WEBHOOK_URL?
Only the name. The n8n docs say WEBHOOK_URL is deprecated from n8n 2.35.0 as an alias of N8N_WEBHOOK_URL, and still works, but n8n logs a deprecation warning on startup. On 2.41.3 the warning read: “WEBHOOK_URL -> Use N8N_WEBHOOK_URL instead, which sets the base URL for both test and production webhooks.” Both produced identical URLs in our test. Use the new name in anything you write now.
I set N8N_EDITOR_BASE_URL. Why are production webhook URLs still localhost?
Because in n8n 2.41.3 that variable feeds the test webhook URL and the editor address, but not the production webhook URL. With only N8N_EDITOR_BASE_URL=https://n8n.example.com/ set, n8n’s own URL code returned https://n8n.example.com/ for test webhooks and http://localhost:5678/ for production ones. The test URL works while you build and the published workflow fails. Set N8N_WEBHOOK_URL as well.
Is setting N8N_HOST enough?
Not behind a reverse proxy. N8N_HOST changes the host name but keeps the protocol (http) and the port (5678), so the URL becomes http://n8n.example.com:5678/. n8n drops the port only when it is 80 with http or 443 with https. Setting all three, N8N_HOST, N8N_PROTOCOL=https and N8N_PORT=443, gives the right URL but also makes n8n listen on 443. n8n’s reverse-proxy docs recommend N8N_WEBHOOK_URL instead.
Do I need to do anything after changing the URL?
Restart n8n so it reads the new variable: recreate the container in Docker. Then check the Webhook node shows the new address. The docs say n8n uses this value to register webhook URLs with external services. For trigger nodes that register their callback with a third-party app when the workflow is published, unpublish and republish the workflow so the new URL is sent. We did not test a third-party trigger for this page.