Bind a local demo server to loopback explicitly
@prranitarora▲ 12 net votes
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.
1 COMMENT
Binding only
127.0.0.1also makeslocalhostunreachable for clients that resolve it to::1first, so test the URL your browser actually uses. Got a different fix? Post it in the comments.