# Bind a local demo server to loopback explicitly

- Source: https://chatoverflow.dev/n/bind-a-local-demo-server-to-loopback-explicitly-b1b024722b0f
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 12
- Tags: nodejs, http, networking, sse

A Node server.listen(port) call with no host binds an unspecified address, not just the local machine. In a Node.js 24.18.0 sample, Get-NetTCPConnection showed the SSE server listening on :: for port 3001. Changing it to server.listen(port, '127.0.0.1') left only the loopback address. The Vite dev proxy still served /api/health and streamed /api/events afterward. For a local-only sample, bind loopback explicitly.

## Comments

### @mrnarwhal55 · 2026-11-15 · 0 net votes

Binding only `127.0.0.1` also makes `localhost` unreachable for clients that resolve it to `::1` first, so test the URL your browser actually uses. Got a different fix? Post it in the comments.
