[{"data":1,"prerenderedAt":803},["ShallowReactive",2],{"content-query-0wlWiAMHwF":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,"updated":15,"cta":16,"related":24,"faq":42,"body":58,"_type":796,"_id":797,"_source":798,"_file":799,"_stem":800,"_extension":801,"sitemap":802},"/localhost/127-0-0-1","localhost",false,"","127.0.0.1: the loopback address and localhost explained","127.0.0.1 is the IPv4 loopback address: it always points to your own computer. How it relates to localhost, ::1 and 0.0.0.0, and fixing refused connections.","reference","127.0.0.1","The loopback address, localhost, ::1 and 0.0.0.0.","Basics",0,"2026-10-28",{"eyebrow":17,"title":18,"text":19,"to":20,"label":21,"secondaryTo":22,"secondaryLabel":23},"Webhook Relay","Give 127.0.0.1 a public URL when you need one","Nothing outside your machine can reach 127.0.0.1. relay connect gives a local port a stable public HTTPS URL, and relay forward delivers webhooks from Stripe, GitHub or Shopify to a handler on localhost, both over an outbound connection.","/tunnels/","Explore Tunnels","/docs/webhooks/internal/localhost/","Receive webhooks on localhost",[25,28,31,34,37,40],{"title":26,"to":27},"localhost:3000","/localhost/3000/",{"title":29,"to":30},"localhost:8080","/localhost/8080/",{"title":32,"to":33},"localhost:5173 (Vite)","/localhost/5173/",{"title":35,"to":36},"What is a tunnel?","/glossary/tunnel/",{"title":38,"to":39},"What is a webhook URL?","/glossary/webhook-url/",{"title":23,"to":41},"/blog/receive-webhooks-on-localhost/",[43,46,49,52,55],{"q":44,"a":45},"What is 127.0.0.1?","127.0.0.1 is the IPv4 loopback address. Traffic sent to it never leaves your computer; the operating system delivers it straight back to a program on the same machine. Every computer has its own 127.0.0.1.",{"q":47,"a":48},"Is 127.0.0.1 the same as localhost?","Almost. localhost is a hostname that normally resolves to 127.0.0.1 and to the IPv6 loopback ::1. If a server listens only on IPv4 or only on IPv6, one of localhost and 127.0.0.1 can work while the other is refused.",{"q":50,"a":51},"Why does 127.0.0.1 refuse to connect?","No program is listening on that port on your machine. Start the server, check which port it actually uses, and include the port in the address, for example http://127.0.0.1:8080.",{"q":53,"a":54},"What is the difference between 127.0.0.1 and 0.0.0.0?","A server bound to 127.0.0.1 only accepts connections from the same machine. A server bound to 0.0.0.0 listens on every network interface, so other devices on the network can reach it too. 0.0.0.0 is a bind address, not an address you browse to.",{"q":56,"a":57},"Can a webhook be sent to 127.0.0.1?","No. A webhook provider sending to 127.0.0.1 would be sending to its own server, and most providers reject loopback URLs outright. To receive webhooks on your machine, give the provider a public URL that forwards to your local port, for example with a webhook relay or a tunnel.",{"type":59,"children":60,"toc":788},"root",[61,99,106,288,314,320,331,444,497,522,543,549,554,662,668,701,707,720,756,782],{"type":62,"tag":63,"props":64,"children":65},"element","p",{},[66,73,75,81,83,89,91,97],{"type":62,"tag":67,"props":68,"children":69},"strong",{},[70],{"type":71,"value":72},"text","127.0.0.1 is the IPv4 loopback address: it always means \"this computer\".",{"type":71,"value":74}," Packets sent to it never reach a network card; the operating system hands them straight back to a program on the same machine. ",{"type":62,"tag":76,"props":77,"children":79},"code",{"className":78},[],[80],{"type":71,"value":5},{"type":71,"value":82}," is the name for it, so ",{"type":62,"tag":76,"props":84,"children":86},{"className":85},[],[87],{"type":71,"value":88},"http://localhost:8080",{"type":71,"value":90}," and ",{"type":62,"tag":76,"props":92,"children":94},{"className":93},[],[95],{"type":71,"value":96},"http://127.0.0.1:8080",{"type":71,"value":98}," normally reach the same server. Every device has its own 127.0.0.1, which is why your phone can't open your laptop's.",{"type":62,"tag":100,"props":101,"children":103},"h2",{"id":102},"_127001-localhost-1-and-0000",[104],{"type":71,"value":105},"127.0.0.1, localhost, ::1 and 0.0.0.0",{"type":62,"tag":107,"props":108,"children":109},"table",{},[110,134],{"type":62,"tag":111,"props":112,"children":113},"thead",{},[114],{"type":62,"tag":115,"props":116,"children":117},"tr",{},[118,124,129],{"type":62,"tag":119,"props":120,"children":121},"th",{},[122],{"type":71,"value":123},"Address",{"type":62,"tag":119,"props":125,"children":126},{},[127],{"type":71,"value":128},"What it is",{"type":62,"tag":119,"props":130,"children":131},{},[132],{"type":71,"value":133},"Use it to",{"type":62,"tag":135,"props":136,"children":137},"tbody",{},[138,160,182,204,236,258],{"type":62,"tag":115,"props":139,"children":140},{},[141,150,155],{"type":62,"tag":142,"props":143,"children":144},"td",{},[145],{"type":62,"tag":76,"props":146,"children":148},{"className":147},[],[149],{"type":71,"value":11},{"type":62,"tag":142,"props":151,"children":152},{},[153],{"type":71,"value":154},"IPv4 loopback",{"type":62,"tag":142,"props":156,"children":157},{},[158],{"type":71,"value":159},"Reach a server on this machine",{"type":62,"tag":115,"props":161,"children":162},{},[163,172,177],{"type":62,"tag":142,"props":164,"children":165},{},[166],{"type":62,"tag":76,"props":167,"children":169},{"className":168},[],[170],{"type":71,"value":171},"127.0.0.0/8",{"type":62,"tag":142,"props":173,"children":174},{},[175],{"type":71,"value":176},"Whole loopback block (127.0.0.1 to 127.255.255.254)",{"type":62,"tag":142,"props":178,"children":179},{},[180],{"type":71,"value":181},"Run several local services on separate IPs",{"type":62,"tag":115,"props":183,"children":184},{},[185,194,199],{"type":62,"tag":142,"props":186,"children":187},{},[188],{"type":62,"tag":76,"props":189,"children":191},{"className":190},[],[192],{"type":71,"value":193},"::1",{"type":62,"tag":142,"props":195,"children":196},{},[197],{"type":71,"value":198},"IPv6 loopback",{"type":62,"tag":142,"props":200,"children":201},{},[202],{"type":71,"value":203},"Same as 127.0.0.1, over IPv6",{"type":62,"tag":115,"props":205,"children":206},{},[207,215,220],{"type":62,"tag":142,"props":208,"children":209},{},[210],{"type":62,"tag":76,"props":211,"children":213},{"className":212},[],[214],{"type":71,"value":5},{"type":62,"tag":142,"props":216,"children":217},{},[218],{"type":71,"value":219},"Hostname for the loopback",{"type":62,"tag":142,"props":221,"children":222},{},[223,225,230,231],{"type":71,"value":224},"Usually resolves to both ",{"type":62,"tag":76,"props":226,"children":228},{"className":227},[],[229],{"type":71,"value":11},{"type":71,"value":90},{"type":62,"tag":76,"props":232,"children":234},{"className":233},[],[235],{"type":71,"value":193},{"type":62,"tag":115,"props":237,"children":238},{},[239,248,253],{"type":62,"tag":142,"props":240,"children":241},{},[242],{"type":62,"tag":76,"props":243,"children":245},{"className":244},[],[246],{"type":71,"value":247},"0.0.0.0",{"type":62,"tag":142,"props":249,"children":250},{},[251],{"type":71,"value":252},"\"All interfaces\" when a server binds",{"type":62,"tag":142,"props":254,"children":255},{},[256],{"type":71,"value":257},"Make a server reachable from other devices",{"type":62,"tag":115,"props":259,"children":260},{},[261,278,283],{"type":62,"tag":142,"props":262,"children":263},{},[264,270,272],{"type":62,"tag":76,"props":265,"children":267},{"className":266},[],[268],{"type":71,"value":269},"192.168.x.x",{"type":71,"value":271},", ",{"type":62,"tag":76,"props":273,"children":275},{"className":274},[],[276],{"type":71,"value":277},"10.x.x.x",{"type":62,"tag":142,"props":279,"children":280},{},[281],{"type":71,"value":282},"Your LAN address",{"type":62,"tag":142,"props":284,"children":285},{},[286],{"type":71,"value":287},"Reach this machine from another device on the network",{"type":62,"tag":63,"props":289,"children":290},{},[291,296,298,304,306,312],{"type":62,"tag":76,"props":292,"children":294},{"className":293},[],[295],{"type":71,"value":5},{"type":71,"value":297}," is defined in your hosts file (",{"type":62,"tag":76,"props":299,"children":301},{"className":300},[],[302],{"type":71,"value":303},"/etc/hosts",{"type":71,"value":305}," on macOS and Linux, ",{"type":62,"tag":76,"props":307,"children":309},{"className":308},[],[310],{"type":71,"value":311},"C:\\Windows\\System32\\drivers\\etc\\hosts",{"type":71,"value":313}," on Windows), and modern browsers and resolvers always treat it as loopback.",{"type":62,"tag":100,"props":315,"children":317},{"id":316},"why-127001-refused-to-connect",[318],{"type":71,"value":319},"Why \"127.0.0.1 refused to connect\"",{"type":62,"tag":63,"props":321,"children":322},{},[323,329],{"type":62,"tag":76,"props":324,"children":326},{"className":325},[],[327],{"type":71,"value":328},"ERR_CONNECTION_REFUSED",{"type":71,"value":330}," on 127.0.0.1 means your machine answered, but no program is listening on that port.",{"type":62,"tag":332,"props":333,"children":334},"ol",{},[335,381,391,436],{"type":62,"tag":336,"props":337,"children":338},"li",{},[339,344,346,352,354,360,361,366,367,373,374,379],{"type":62,"tag":67,"props":340,"children":341},{},[342],{"type":71,"value":343},"Include the port.",{"type":71,"value":345}," ",{"type":62,"tag":76,"props":347,"children":349},{"className":348},[],[350],{"type":71,"value":351},"http://127.0.0.1",{"type":71,"value":353}," means port 80. Dev servers use ",{"type":62,"tag":355,"props":356,"children":357},"a",{"href":27},[358],{"type":71,"value":359},"3000",{"type":71,"value":271},{"type":62,"tag":355,"props":362,"children":363},{"href":33},[364],{"type":71,"value":365},"5173",{"type":71,"value":271},{"type":62,"tag":355,"props":368,"children":370},{"href":369},"/localhost/8000/",[371],{"type":71,"value":372},"8000",{"type":71,"value":271},{"type":62,"tag":355,"props":375,"children":376},{"href":30},[377],{"type":71,"value":378},"8080",{"type":71,"value":380}," and so on.",{"type":62,"tag":336,"props":382,"children":383},{},[384,389],{"type":62,"tag":67,"props":385,"children":386},{},[387],{"type":71,"value":388},"Start the server",{"type":71,"value":390}," and read the URL it prints.",{"type":62,"tag":336,"props":392,"children":393},{},[394,399,401,406,408,413,415,420,422,427,429,434],{"type":62,"tag":67,"props":395,"children":396},{},[397],{"type":71,"value":398},"IPv4 vs IPv6.",{"type":71,"value":400}," If ",{"type":62,"tag":76,"props":402,"children":404},{"className":403},[],[405],{"type":71,"value":5},{"type":71,"value":407}," works but ",{"type":62,"tag":76,"props":409,"children":411},{"className":410},[],[412],{"type":71,"value":11},{"type":71,"value":414}," doesn't (or the reverse), the server is bound to only ",{"type":62,"tag":76,"props":416,"children":418},{"className":417},[],[419],{"type":71,"value":193},{"type":71,"value":421}," or only ",{"type":62,"tag":76,"props":423,"children":425},{"className":424},[],[426],{"type":71,"value":11},{"type":71,"value":428},". Bind it explicitly to the one you use, or to ",{"type":62,"tag":76,"props":430,"children":432},{"className":431},[],[433],{"type":71,"value":247},{"type":71,"value":435},".",{"type":62,"tag":336,"props":437,"children":438},{},[439],{"type":62,"tag":67,"props":440,"children":441},{},[442],{"type":71,"value":443},"Check what's listening:",{"type":62,"tag":445,"props":446,"children":450},"pre",{"className":447,"code":448,"language":449,"meta":7,"style":7},"language-bash shiki shiki-themes github-dark","# macOS / Linux\nlsof -iTCP -sTCP:LISTEN -n -P\n","bash",[451],{"type":62,"tag":76,"props":452,"children":453},{"__ignoreMap":7},[454,466],{"type":62,"tag":455,"props":456,"children":459},"span",{"class":457,"line":458},"line",1,[460],{"type":62,"tag":455,"props":461,"children":463},{"style":462},"--shiki-default:#6A737D",[464],{"type":71,"value":465},"# macOS / Linux\n",{"type":62,"tag":455,"props":467,"children":469},{"class":457,"line":468},2,[470,476,482,487,492],{"type":62,"tag":455,"props":471,"children":473},{"style":472},"--shiki-default:#B392F0",[474],{"type":71,"value":475},"lsof",{"type":62,"tag":455,"props":477,"children":479},{"style":478},"--shiki-default:#79B8FF",[480],{"type":71,"value":481}," -iTCP",{"type":62,"tag":455,"props":483,"children":484},{"style":478},[485],{"type":71,"value":486}," -sTCP:LISTEN",{"type":62,"tag":455,"props":488,"children":489},{"style":478},[490],{"type":71,"value":491}," -n",{"type":62,"tag":455,"props":493,"children":494},{"style":478},[495],{"type":71,"value":496}," -P\n",{"type":62,"tag":445,"props":498,"children":502},{"className":499,"code":500,"language":501,"meta":7,"style":7},"language-powershell shiki shiki-themes github-dark","# Windows\nnetstat -ano | findstr LISTENING\n","powershell",[503],{"type":62,"tag":76,"props":504,"children":505},{"__ignoreMap":7},[506,514],{"type":62,"tag":455,"props":507,"children":508},{"class":457,"line":458},[509],{"type":62,"tag":455,"props":510,"children":511},{},[512],{"type":71,"value":513},"# Windows\n",{"type":62,"tag":455,"props":515,"children":516},{"class":457,"line":468},[517],{"type":62,"tag":455,"props":518,"children":519},{},[520],{"type":71,"value":521},"netstat -ano | findstr LISTENING\n",{"type":62,"tag":63,"props":523,"children":524},{},[525,527,533,535,541],{"type":71,"value":526},"Free a port with ",{"type":62,"tag":76,"props":528,"children":530},{"className":529},[],[531],{"type":71,"value":532},"kill -9 $(lsof -ti :PORT)",{"type":71,"value":534}," on macOS and Linux, or ",{"type":62,"tag":76,"props":536,"children":538},{"className":537},[],[539],{"type":71,"value":540},"taskkill /PID \u003Cpid> /F",{"type":71,"value":542}," on Windows.",{"type":62,"tag":100,"props":544,"children":546},{"id":545},"docker-vms-and-emulators",[547],{"type":71,"value":548},"Docker, VMs and emulators",{"type":62,"tag":63,"props":550,"children":551},{},[552],{"type":71,"value":553},"127.0.0.1 is local to each network namespace, which trips people up:",{"type":62,"tag":555,"props":556,"children":557},"ul",{},[558,590,620,645],{"type":62,"tag":336,"props":559,"children":560},{},[561,566,567,572,574,580,582,588],{"type":62,"tag":67,"props":562,"children":563},{},[564],{"type":71,"value":565},"Inside a Docker container",{"type":71,"value":271},{"type":62,"tag":76,"props":568,"children":570},{"className":569},[],[571],{"type":71,"value":11},{"type":71,"value":573}," is the container, not your computer. To reach a service on the host, use ",{"type":62,"tag":76,"props":575,"children":577},{"className":576},[],[578],{"type":71,"value":579},"host.docker.internal",{"type":71,"value":581}," (Docker Desktop, or ",{"type":62,"tag":76,"props":583,"children":585},{"className":584},[],[586],{"type":71,"value":587},"--add-host=host.docker.internal:host-gateway",{"type":71,"value":589}," on Linux).",{"type":62,"tag":336,"props":591,"children":592},{},[593,603,605,610,612,618],{"type":62,"tag":67,"props":594,"children":595},{},[596,598],{"type":71,"value":597},"A server inside a container must bind ",{"type":62,"tag":76,"props":599,"children":601},{"className":600},[],[602],{"type":71,"value":247},{"type":71,"value":604},", not ",{"type":62,"tag":76,"props":606,"children":608},{"className":607},[],[609],{"type":71,"value":11},{"type":71,"value":611},", or published ports (",{"type":62,"tag":76,"props":613,"children":615},{"className":614},[],[616],{"type":71,"value":617},"-p 8080:8080",{"type":71,"value":619},") won't reach it.",{"type":62,"tag":336,"props":621,"children":622},{},[623,628,630,636,638,643],{"type":62,"tag":67,"props":624,"children":625},{},[626],{"type":71,"value":627},"The Android emulator",{"type":71,"value":629}," reaches your computer at ",{"type":62,"tag":76,"props":631,"children":633},{"className":632},[],[634],{"type":71,"value":635},"10.0.2.2",{"type":71,"value":637},"; its own ",{"type":62,"tag":76,"props":639,"children":641},{"className":640},[],[642],{"type":71,"value":11},{"type":71,"value":644}," is the emulated phone.",{"type":62,"tag":336,"props":646,"children":647},{},[648,653,655,660],{"type":62,"tag":67,"props":649,"children":650},{},[651],{"type":71,"value":652},"WSL2",{"type":71,"value":654}," forwards ",{"type":62,"tag":76,"props":656,"children":658},{"className":657},[],[659],{"type":71,"value":5},{"type":71,"value":661}," to Windows in most setups. If not, use the WSL VM's IP.",{"type":62,"tag":100,"props":663,"children":665},{"id":664},"binding-to-127001-vs-0000",[666],{"type":71,"value":667},"Binding to 127.0.0.1 vs 0.0.0.0",{"type":62,"tag":63,"props":669,"children":670},{},[671,673,678,680,685,687,693,695,700],{"type":71,"value":672},"Binding a server to ",{"type":62,"tag":76,"props":674,"children":676},{"className":675},[],[677],{"type":71,"value":11},{"type":71,"value":679}," is the safe default: only programs on the same machine can connect. Django, Flask, Vite, Jupyter, Ollama and PostgreSQL all start this way. Bind to ",{"type":62,"tag":76,"props":681,"children":683},{"className":682},[],[684],{"type":71,"value":247},{"type":71,"value":686}," only when other devices need to connect, and only on a network you trust. Then open ",{"type":62,"tag":76,"props":688,"children":690},{"className":689},[],[691],{"type":71,"value":692},"http://YOUR-LAN-IP:PORT",{"type":71,"value":694}," from the other device, never ",{"type":62,"tag":76,"props":696,"children":698},{"className":697},[],[699],{"type":71,"value":11},{"type":71,"value":435},{"type":62,"tag":100,"props":702,"children":704},{"id":703},"_127001-and-webhooks",[705],{"type":71,"value":706},"127.0.0.1 and webhooks",{"type":62,"tag":63,"props":708,"children":709},{},[710,712,718],{"type":71,"value":711},"A webhook provider can't deliver to ",{"type":62,"tag":76,"props":713,"children":715},{"className":714},[],[716],{"type":71,"value":717},"http://127.0.0.1:3000/webhooks",{"type":71,"value":719},". To Stripe or GitHub, 127.0.0.1 is their own server, and most providers reject loopback and private addresses outright. Your local handler needs a public URL that forwards to it:",{"type":62,"tag":445,"props":721,"children":723},{"className":447,"code":722,"language":449,"meta":7,"style":7},"relay forward --bucket my-app http://127.0.0.1:3000/webhooks\n",[724],{"type":62,"tag":76,"props":725,"children":726},{"__ignoreMap":7},[727],{"type":62,"tag":455,"props":728,"children":729},{"class":457,"line":458},[730,735,741,746,751],{"type":62,"tag":455,"props":731,"children":732},{"style":472},[733],{"type":71,"value":734},"relay",{"type":62,"tag":455,"props":736,"children":738},{"style":737},"--shiki-default:#9ECBFF",[739],{"type":71,"value":740}," forward",{"type":62,"tag":455,"props":742,"children":743},{"style":478},[744],{"type":71,"value":745}," --bucket",{"type":62,"tag":455,"props":747,"children":748},{"style":737},[749],{"type":71,"value":750}," my-app",{"type":62,"tag":455,"props":752,"children":753},{"style":737},[754],{"type":71,"value":755}," http://127.0.0.1:3000/webhooks\n",{"type":62,"tag":63,"props":757,"children":758},{},[759,761,766,768,774,776,781],{"type":71,"value":760},"The ",{"type":62,"tag":76,"props":762,"children":764},{"className":763},[],[765],{"type":71,"value":734},{"type":71,"value":767}," agent connects outbound, so there's no router or firewall change, and the bucket's public URL stays the same between sessions. To share a whole local site rather than just receive webhooks, ",{"type":62,"tag":76,"props":769,"children":771},{"className":770},[],[772],{"type":71,"value":773},"relay connect --name my-app http://127.0.0.1:3000",{"type":71,"value":775}," gives the port a public HTTPS URL. See ",{"type":62,"tag":355,"props":777,"children":778},{"href":22},[779],{"type":71,"value":780},"receive webhooks on localhost",{"type":71,"value":435},{"type":62,"tag":783,"props":784,"children":785},"style",{},[786],{"type":71,"value":787},"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":789,"depth":789,"links":790},3,[791,792,793,794,795],{"id":102,"depth":468,"text":105},{"id":316,"depth":468,"text":319},{"id":545,"depth":468,"text":548},{"id":664,"depth":468,"text":667},{"id":703,"depth":468,"text":706},"markdown","content:localhost:127-0-0-1.md","content","localhost/127-0-0-1.md","localhost/127-0-0-1","md",{"loc":4},1793199808633]