-
Notifications
You must be signed in to change notification settings - Fork 841
Description
Expectation
Both backend and frontend dev servers should listen on both IPv4 and IPv6 addresses (not IPv4-only), so users can connect via 127.0.0.1/LAN IPv4 and ::1/LAN IPv6.
Problem
Current behavior is IPv4-only in key paths, which prevents IPv6 connections.
Observed behavior before fix:
- Backend server bound with IPv4 wildcard (
0.0.0.0) and showed only IPv4 listener on port3001. - Vite frontend effectively bound IPv4-only (
0.0.0.0) in this setup, so it did not accept IPv6 loopback/connectivity.
This creates inconsistent local networking behavior and blocks IPv6-first/dev environments.
Short solution
Use IPv6 wildcard + dual-stack-friendly binding, with IPv4 fallback when IPv6 is unavailable.
Applicable changes:
server/index.js:1921addlistenWithBestAvailableHost(port)using:- primary listen options
{ host: '::', ipv6Only: false } - fallback
{ host: '0.0.0.0' }onEAFNOSUPPORT/EINVAL
- primary listen options
server/index.js:1969replace directserver.listen(PORT, '0.0.0.0', ...)withawait listenWithBestAvailableHost(PORT)vite.config.js:39set Vite host to IPv6 wildcard by default:host: env.VITE_HOST || '::'
package.json:29remove CLI host override so config host is respected:"client": "vite"
With this, both servers are reachable on IPv4 and IPv6 where dual-stack is supported.
-- Edit --
Coderabbit flagged #168 as a possible duplicate.
This is not technically true. They are related.
This issue and the enclosed solution adjust the IP binding of the server(s) so that requests from remote clients are answered.
#168 addresses hardcoded 'localhost' on systems that resolve localhost to the most 'convenient' (in a good way) ip.
Fixing the underlying server binding would mean that localhost should always work.