[{"data":1,"prerenderedAt":802},["ShallowReactive",2],{"content-query-tvyM9dwvfr":3},{"_path":4,"_dir":5,"_draft":6,"_partial":6,"_locale":7,"title":8,"description":9,"layout":10,"crumb":11,"summary":12,"group":13,"order":14,"port":15,"updated":16,"cta":17,"related":25,"faq":44,"body":57,"_type":795,"_id":796,"_source":797,"_file":798,"_stem":799,"_extension":800,"sitemap":801},"/localhost/5678","localhost",false,"","localhost:5678: n8n's default port and webhook URLs explained","localhost:5678 is n8n's default port. Fix 'refused to connect', change N8N_PORT, and make n8n webhooks work on localhost with WEBHOOK_URL or a relay.","reference","localhost:5678","n8n workflow automation (editor and webhooks).","Data, AI and automation",12,5678,"2026-10-28",{"eyebrow":18,"title":19,"text":20,"to":21,"label":22,"secondaryTo":23,"secondaryLabel":24},"n8n + Webhook Relay","Receive webhooks in self-hosted n8n with no public URL","The Webhook Relay Trigger community node gives n8n a stable public webhook URL. n8n connects out over a WebSocket, so localhost:5678 never has to be exposed and you don't need WEBHOOK_URL, a reverse proxy or a tunnel.","/docs/tutorials/n8n/webhook-trigger/","n8n webhook trigger tutorial","/tunnels/","Explore Tunnels",[26,29,32,35,38,41],{"title":27,"to":28},"localhost:8123 (Home Assistant)","/localhost/8123/",{"title":30,"to":31},"localhost:11434 (Ollama)","/localhost/11434/",{"title":33,"to":34},"n8n Email Trigger","/docs/tutorials/n8n/email-trigger/",{"title":36,"to":37},"What is a webhook URL?","/glossary/webhook-url/",{"title":39,"to":40},"What is a webhook listener?","/glossary/webhook-listener/",{"title":42,"to":43},"502 Bad Gateway","/http-errors/502-bad-gateway/",[45,48,51,54],{"q":46,"a":47},"What is localhost:5678?","localhost:5678 is the default port of n8n, the workflow automation tool. Starting n8n with npx n8n or the Docker image serves the editor at http://localhost:5678, and webhook nodes receive requests on the same port under /webhook/ and /webhook-test/.",{"q":49,"a":50},"What is the difference between the n8n test URL and production URL?","The test URL contains /webhook-test/ and only accepts a request while you have clicked Listen for test event in the editor, then it stops. The production URL contains /webhook/ and only works while the workflow is active. Calling the wrong one returns a 404 saying the webhook is not registered.",{"q":52,"a":53},"Why do my n8n webhook URLs say localhost?","n8n builds webhook URLs from its own host and port unless you tell it the public address. Set the WEBHOOK_URL environment variable to your public HTTPS URL, for example https://n8n.example.com/, and restart n8n so the webhook nodes show and register the right URL.",{"q":55,"a":56},"How do I change the n8n port?","Set the N8N_PORT environment variable, for example N8N_PORT=5679, and restart n8n. With Docker you can instead keep n8n on 5678 inside the container and publish a different host port with -p 5679:5678.",{"type":58,"children":59,"toc":787},"root",[60,104,111,218,230,236,335,341,412,445,465,471,476,598,610,616,629,655,676,681,715,735,741,781],{"type":61,"tag":62,"props":63,"children":64},"element","p",{},[65,78,80,86,88,94,96,102],{"type":61,"tag":66,"props":67,"children":68},"strong",{},[69,76],{"type":61,"tag":70,"props":71,"children":73},"code",{"className":72},[],[74],{"type":75,"value":11},"text",{"type":75,"value":77}," is the default port of n8n, the open-source workflow automation tool.",{"type":75,"value":79}," The editor runs at ",{"type":61,"tag":70,"props":81,"children":83},{"className":82},[],[84],{"type":75,"value":85},"http://localhost:5678",{"type":75,"value":87},", and Webhook nodes receive requests on the same port at ",{"type":61,"tag":70,"props":89,"children":91},{"className":90},[],[92],{"type":75,"value":93},"/webhook/...",{"type":75,"value":95}," (production) and ",{"type":61,"tag":70,"props":97,"children":99},{"className":98},[],[100],{"type":75,"value":101},"/webhook-test/...",{"type":75,"value":103}," (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.",{"type":61,"tag":105,"props":106,"children":108},"h2",{"id":107},"start-n8n-on-5678",[109],{"type":75,"value":110},"Start n8n on 5678",{"type":61,"tag":112,"props":113,"children":117},"pre",{"className":114,"code":115,"language":116,"meta":7,"style":7},"language-bash shiki shiki-themes github-dark","npx n8n\n# or Docker\ndocker run -it --rm --name n8n -p 5678:5678 \\\n  -v n8n_data:/home/node/.n8n docker.n8n.io/n8nio/n8n\n","bash",[118],{"type":61,"tag":70,"props":119,"children":120},{"__ignoreMap":7},[121,139,149,199],{"type":61,"tag":122,"props":123,"children":126},"span",{"class":124,"line":125},"line",1,[127,133],{"type":61,"tag":122,"props":128,"children":130},{"style":129},"--shiki-default:#B392F0",[131],{"type":75,"value":132},"npx",{"type":61,"tag":122,"props":134,"children":136},{"style":135},"--shiki-default:#9ECBFF",[137],{"type":75,"value":138}," n8n\n",{"type":61,"tag":122,"props":140,"children":142},{"class":124,"line":141},2,[143],{"type":61,"tag":122,"props":144,"children":146},{"style":145},"--shiki-default:#6A737D",[147],{"type":75,"value":148},"# or Docker\n",{"type":61,"tag":122,"props":150,"children":152},{"class":124,"line":151},3,[153,158,163,169,174,179,184,189,194],{"type":61,"tag":122,"props":154,"children":155},{"style":129},[156],{"type":75,"value":157},"docker",{"type":61,"tag":122,"props":159,"children":160},{"style":135},[161],{"type":75,"value":162}," run",{"type":61,"tag":122,"props":164,"children":166},{"style":165},"--shiki-default:#79B8FF",[167],{"type":75,"value":168}," -it",{"type":61,"tag":122,"props":170,"children":171},{"style":165},[172],{"type":75,"value":173}," --rm",{"type":61,"tag":122,"props":175,"children":176},{"style":165},[177],{"type":75,"value":178}," --name",{"type":61,"tag":122,"props":180,"children":181},{"style":135},[182],{"type":75,"value":183}," n8n",{"type":61,"tag":122,"props":185,"children":186},{"style":165},[187],{"type":75,"value":188}," -p",{"type":61,"tag":122,"props":190,"children":191},{"style":135},[192],{"type":75,"value":193}," 5678:5678",{"type":61,"tag":122,"props":195,"children":196},{"style":165},[197],{"type":75,"value":198}," \\\n",{"type":61,"tag":122,"props":200,"children":202},{"class":124,"line":201},4,[203,208,213],{"type":61,"tag":122,"props":204,"children":205},{"style":165},[206],{"type":75,"value":207},"  -v",{"type":61,"tag":122,"props":209,"children":210},{"style":135},[211],{"type":75,"value":212}," n8n_data:/home/node/.n8n",{"type":61,"tag":122,"props":214,"children":215},{"style":135},[216],{"type":75,"value":217}," docker.n8n.io/n8nio/n8n\n",{"type":61,"tag":62,"props":219,"children":220},{},[221,223,228],{"type":75,"value":222},"Then open ",{"type":61,"tag":70,"props":224,"children":226},{"className":225},[],[227],{"type":75,"value":85},{"type":75,"value":229}," and create the owner account.",{"type":61,"tag":105,"props":231,"children":233},{"id":232},"fix-localhost5678-refused-to-connect",[234],{"type":75,"value":235},"Fix \"localhost:5678 refused to connect\"",{"type":61,"tag":237,"props":238,"children":239},"ol",{},[240,259,293,317],{"type":61,"tag":241,"props":242,"children":243},"li",{},[244,257],{"type":61,"tag":66,"props":245,"children":246},{},[247,249,255],{"type":75,"value":248},"Wait for ",{"type":61,"tag":70,"props":250,"children":252},{"className":251},[],[253],{"type":75,"value":254},"Editor is now accessible via: http://localhost:5678",{"type":75,"value":256},".",{"type":75,"value":258}," First start runs database migrations and can take a while.",{"type":61,"tag":241,"props":260,"children":261},{},[262,267,269,275,277,283,285,291],{"type":61,"tag":66,"props":263,"children":264},{},[265],{"type":75,"value":266},"Docker port mapping.",{"type":75,"value":268}," ",{"type":61,"tag":70,"props":270,"children":272},{"className":271},[],[273],{"type":75,"value":274},"docker ps",{"type":75,"value":276}," must show ",{"type":61,"tag":70,"props":278,"children":280},{"className":279},[],[281],{"type":75,"value":282},"0.0.0.0:5678->5678/tcp",{"type":75,"value":284},". With Docker Compose, check the ",{"type":61,"tag":70,"props":286,"children":288},{"className":287},[],[289],{"type":75,"value":290},"ports:",{"type":75,"value":292}," entry for the n8n service.",{"type":61,"tag":241,"props":294,"children":295},{},[296,301,303,308,310,316],{"type":61,"tag":66,"props":297,"children":298},{},[299],{"type":75,"value":300},"Secure cookie error.",{"type":75,"value":302}," Opening n8n over plain HTTP on anything other than ",{"type":61,"tag":70,"props":304,"children":306},{"className":305},[],[307],{"type":75,"value":5},{"type":75,"value":309}," (a LAN IP, say) shows a warning about secure cookies. Use HTTPS, or for local testing only set ",{"type":61,"tag":70,"props":311,"children":313},{"className":312},[],[314],{"type":75,"value":315},"N8N_SECURE_COOKIE=false",{"type":75,"value":256},{"type":61,"tag":241,"props":318,"children":319},{},[320,325,327,333],{"type":61,"tag":66,"props":321,"children":322},{},[323],{"type":75,"value":324},"Wrong port.",{"type":75,"value":326}," If you set ",{"type":61,"tag":70,"props":328,"children":330},{"className":329},[],[331],{"type":75,"value":332},"N8N_PORT",{"type":75,"value":334},", the editor moved with it.",{"type":61,"tag":105,"props":336,"children":338},{"id":337},"free-or-change-port-5678",[339],{"type":75,"value":340},"Free or change port 5678",{"type":61,"tag":112,"props":342,"children":344},{"className":114,"code":343,"language":116,"meta":7,"style":7},"# macOS / Linux\nlsof -i :5678\nkill -9 $(lsof -ti :5678)\n",[345],{"type":61,"tag":70,"props":346,"children":347},{"__ignoreMap":7},[348,356,374],{"type":61,"tag":122,"props":349,"children":350},{"class":124,"line":125},[351],{"type":61,"tag":122,"props":352,"children":353},{"style":145},[354],{"type":75,"value":355},"# macOS / Linux\n",{"type":61,"tag":122,"props":357,"children":358},{"class":124,"line":141},[359,364,369],{"type":61,"tag":122,"props":360,"children":361},{"style":129},[362],{"type":75,"value":363},"lsof",{"type":61,"tag":122,"props":365,"children":366},{"style":165},[367],{"type":75,"value":368}," -i",{"type":61,"tag":122,"props":370,"children":371},{"style":135},[372],{"type":75,"value":373}," :5678\n",{"type":61,"tag":122,"props":375,"children":376},{"class":124,"line":151},[377,382,387,393,397,402,407],{"type":61,"tag":122,"props":378,"children":379},{"style":165},[380],{"type":75,"value":381},"kill",{"type":61,"tag":122,"props":383,"children":384},{"style":165},[385],{"type":75,"value":386}," -9",{"type":61,"tag":122,"props":388,"children":390},{"style":389},"--shiki-default:#E1E4E8",[391],{"type":75,"value":392}," $(",{"type":61,"tag":122,"props":394,"children":395},{"style":129},[396],{"type":75,"value":363},{"type":61,"tag":122,"props":398,"children":399},{"style":165},[400],{"type":75,"value":401}," -ti",{"type":61,"tag":122,"props":403,"children":404},{"style":135},[405],{"type":75,"value":406}," :5678",{"type":61,"tag":122,"props":408,"children":409},{"style":389},[410],{"type":75,"value":411},")\n",{"type":61,"tag":112,"props":413,"children":417},{"className":414,"code":415,"language":416,"meta":7,"style":7},"language-powershell shiki shiki-themes github-dark","# Windows\nnetstat -ano | findstr :5678\ntaskkill /PID \u003Cpid> /F\n","powershell",[418],{"type":61,"tag":70,"props":419,"children":420},{"__ignoreMap":7},[421,429,437],{"type":61,"tag":122,"props":422,"children":423},{"class":124,"line":125},[424],{"type":61,"tag":122,"props":425,"children":426},{},[427],{"type":75,"value":428},"# Windows\n",{"type":61,"tag":122,"props":430,"children":431},{"class":124,"line":141},[432],{"type":61,"tag":122,"props":433,"children":434},{},[435],{"type":75,"value":436},"netstat -ano | findstr :5678\n",{"type":61,"tag":122,"props":438,"children":439},{"class":124,"line":151},[440],{"type":61,"tag":122,"props":441,"children":442},{},[443],{"type":75,"value":444},"taskkill /PID \u003Cpid> /F\n",{"type":61,"tag":62,"props":446,"children":447},{},[448,450,456,458,464],{"type":75,"value":449},"Change the port with ",{"type":61,"tag":70,"props":451,"children":453},{"className":452},[],[454],{"type":75,"value":455},"N8N_PORT=5679 npx n8n",{"type":75,"value":457},", or in Docker keep the container port and change the host side: ",{"type":61,"tag":70,"props":459,"children":461},{"className":460},[],[462],{"type":75,"value":463},"-p 5679:5678",{"type":75,"value":256},{"type":61,"tag":105,"props":466,"children":468},{"id":467},"n8n-test-url-vs-production-url",[469],{"type":75,"value":470},"n8n test URL vs production URL",{"type":61,"tag":62,"props":472,"children":473},{},[474],{"type":75,"value":475},"Every Webhook node has two URLs, and mixing them up is the most common n8n webhook problem:",{"type":61,"tag":477,"props":478,"children":479},"table",{},[480,502],{"type":61,"tag":481,"props":482,"children":483},"thead",{},[484],{"type":61,"tag":485,"props":486,"children":487},"tr",{},[488,492,497],{"type":61,"tag":489,"props":490,"children":491},"th",{},[],{"type":61,"tag":489,"props":493,"children":494},{},[495],{"type":75,"value":496},"Test URL",{"type":61,"tag":489,"props":498,"children":499},{},[500],{"type":75,"value":501},"Production URL",{"type":61,"tag":503,"props":504,"children":505},"tbody",{},[506,533,557,575],{"type":61,"tag":485,"props":507,"children":508},{},[509,515,524],{"type":61,"tag":510,"props":511,"children":512},"td",{},[513],{"type":75,"value":514},"Path",{"type":61,"tag":510,"props":516,"children":517},{},[518],{"type":61,"tag":70,"props":519,"children":521},{"className":520},[],[522],{"type":75,"value":523},"/webhook-test/\u003Cpath>",{"type":61,"tag":510,"props":525,"children":526},{},[527],{"type":61,"tag":70,"props":528,"children":530},{"className":529},[],[531],{"type":75,"value":532},"/webhook/\u003Cpath>",{"type":61,"tag":485,"props":534,"children":535},{},[536,541,552],{"type":61,"tag":510,"props":537,"children":538},{},[539],{"type":75,"value":540},"Works when",{"type":61,"tag":510,"props":542,"children":543},{},[544,546],{"type":75,"value":545},"You clicked ",{"type":61,"tag":547,"props":548,"children":549},"em",{},[550],{"type":75,"value":551},"Listen for test event",{"type":61,"tag":510,"props":553,"children":554},{},[555],{"type":75,"value":556},"The workflow is active",{"type":61,"tag":485,"props":558,"children":559},{},[560,565,570],{"type":61,"tag":510,"props":561,"children":562},{},[563],{"type":75,"value":564},"Requests accepted",{"type":61,"tag":510,"props":566,"children":567},{},[568],{"type":75,"value":569},"One, then it stops listening",{"type":61,"tag":510,"props":571,"children":572},{},[573],{"type":75,"value":574},"Every request",{"type":61,"tag":485,"props":576,"children":577},{},[578,583,588],{"type":61,"tag":510,"props":579,"children":580},{},[581],{"type":75,"value":582},"Shows in editor",{"type":61,"tag":510,"props":584,"children":585},{},[586],{"type":75,"value":587},"Yes, live",{"type":61,"tag":510,"props":589,"children":590},{},[591,593],{"type":75,"value":592},"In ",{"type":61,"tag":547,"props":594,"children":595},{},[596],{"type":75,"value":597},"Executions",{"type":61,"tag":62,"props":599,"children":600},{},[601,603,608],{"type":75,"value":602},"A request to the wrong one gets a ",{"type":61,"tag":66,"props":604,"children":605},{},[606],{"type":75,"value":607},"404 \"The requested webhook is not registered\"",{"type":75,"value":609},". Use the test URL while building, then switch the provider to the production URL and activate the workflow.",{"type":61,"tag":105,"props":611,"children":613},{"id":612},"make-n8n-webhooks-work-behind-a-tunnel-or-proxy",[614],{"type":75,"value":615},"Make n8n webhooks work behind a tunnel or proxy",{"type":61,"tag":62,"props":617,"children":618},{},[619,621,627],{"type":75,"value":620},"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 ",{"type":61,"tag":70,"props":622,"children":624},{"className":623},[],[625],{"type":75,"value":626},"http://localhost:5678/webhook/...",{"type":75,"value":628},", which no provider can reach. When n8n sits behind a reverse proxy or a tunnel, tell it the public address:",{"type":61,"tag":112,"props":630,"children":632},{"className":114,"code":631,"language":116,"meta":7,"style":7},"WEBHOOK_URL=https://n8n.example.com/\n",[633],{"type":61,"tag":70,"props":634,"children":635},{"__ignoreMap":7},[636],{"type":61,"tag":122,"props":637,"children":638},{"class":124,"line":125},[639,644,650],{"type":61,"tag":122,"props":640,"children":641},{"style":389},[642],{"type":75,"value":643},"WEBHOOK_URL",{"type":61,"tag":122,"props":645,"children":647},{"style":646},"--shiki-default:#F97583",[648],{"type":75,"value":649},"=",{"type":61,"tag":122,"props":651,"children":652},{"style":135},[653],{"type":75,"value":654},"https://n8n.example.com/\n",{"type":61,"tag":62,"props":656,"children":657},{},[658,660,666,668,674],{"type":75,"value":659},"Restart n8n and the Webhook nodes show the public URL. If a reverse proxy terminates TLS, also set ",{"type":61,"tag":70,"props":661,"children":663},{"className":662},[],[664],{"type":75,"value":665},"N8N_PROXY_HOPS=1",{"type":75,"value":667}," so n8n trusts the forwarded headers. ",{"type":61,"tag":70,"props":669,"children":671},{"className":670},[],[672],{"type":75,"value":673},"n8n start --tunnel",{"type":75,"value":675}," exists, but n8n describes it as for local development and testing only.",{"type":61,"tag":62,"props":677,"children":678},{},[679],{"type":75,"value":680},"You can then put the whole instance on a public URL:",{"type":61,"tag":112,"props":682,"children":684},{"className":114,"code":683,"language":116,"meta":7,"style":7},"relay connect --name my-n8n http://localhost:5678\n",[685],{"type":61,"tag":70,"props":686,"children":687},{"__ignoreMap":7},[688],{"type":61,"tag":122,"props":689,"children":690},{"class":124,"line":125},[691,696,701,705,710],{"type":61,"tag":122,"props":692,"children":693},{"style":129},[694],{"type":75,"value":695},"relay",{"type":61,"tag":122,"props":697,"children":698},{"style":135},[699],{"type":75,"value":700}," connect",{"type":61,"tag":122,"props":702,"children":703},{"style":165},[704],{"type":75,"value":178},{"type":61,"tag":122,"props":706,"children":707},{"style":135},[708],{"type":75,"value":709}," my-n8n",{"type":61,"tag":122,"props":711,"children":712},{"style":135},[713],{"type":75,"value":714}," http://localhost:5678\n",{"type":61,"tag":62,"props":716,"children":717},{},[718,720,725,727,733],{"type":75,"value":719},"and set ",{"type":61,"tag":70,"props":721,"children":723},{"className":722},[],[724],{"type":75,"value":643},{"type":75,"value":726}," to the HTTPS URL it prints. Reusing the same ",{"type":61,"tag":70,"props":728,"children":730},{"className":729},[],[731],{"type":75,"value":732},"--name",{"type":75,"value":734}," 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.",{"type":61,"tag":105,"props":736,"children":738},{"id":737},"receive-webhooks-without-exposing-n8n",[739],{"type":75,"value":740},"Receive webhooks without exposing n8n",{"type":61,"tag":62,"props":742,"children":743},{},[744,746,752,754,759,761,766,768,772,774,780],{"type":75,"value":745},"If you only need webhooks in, not remote access to the editor, you don't have to expose port 5678 at all. The ",{"type":61,"tag":747,"props":748,"children":749},"a",{"href":21},[750],{"type":75,"value":751},"Webhook Relay Trigger node",{"type":75,"value":753}," gives each workflow a stable public URL; n8n opens an ",{"type":61,"tag":66,"props":755,"children":756},{},[757],{"type":75,"value":758},"outbound WebSocket",{"type":75,"value":760}," and events flow in over it. No ",{"type":61,"tag":70,"props":762,"children":764},{"className":763},[],[765],{"type":75,"value":643},{"type":75,"value":767},", no reverse proxy and no inbound port. The same works for email with the ",{"type":61,"tag":747,"props":769,"children":770},{"href":34},[771],{"type":75,"value":33},{"type":75,"value":773},", and for chat apps in the ",{"type":61,"tag":747,"props":775,"children":777},{"href":776},"/docs/tutorials/n8n/whatsapp-cloud-api-webhook/",[778],{"type":75,"value":779},"WhatsApp Cloud API tutorial",{"type":75,"value":256},{"type":61,"tag":782,"props":783,"children":784},"style",{},[785],{"type":75,"value":786},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}",{"title":7,"searchDepth":151,"depth":151,"links":788},[789,790,791,792,793,794],{"id":107,"depth":141,"text":110},{"id":232,"depth":141,"text":235},{"id":337,"depth":141,"text":340},{"id":467,"depth":141,"text":470},{"id":612,"depth":141,"text":615},{"id":737,"depth":141,"text":740},"markdown","content:localhost:5678.md","content","localhost/5678.md","localhost/5678","md",{"loc":4},1793199810454]