adapter-node: IPv4-only bind (0.0.0.0) default diverges from Node.js http.Server, why? #15832
therealPaulPlay
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Problem Analysis
Solutions## Option 1: Restore Dual-Stack Binding (SvelteKit)Override the default host binding in your container environment to enable both IPv4 and IPv6 support: docker-compose.yml or container envenvironment:
Option 2: Force IPv4 Upstream (NGINX)If the host environment does not cleanly support IPv6 bindings, explicitly restrict NGINX to the IPv4 loopback: nginx.conflocation / { |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I noticed occasional NGINX errors on my server after switching a container (which uses
--network hostin docker) from Express.js to SvelteKit and realized that while the Node.jshttp.Server.listen()defaults to binding::and thereby allows for dual-stack connections, SvelteKit defaults to binding0.0.0.0and only supports IPv4.This is a bit of a footgun, because the expectation is for the node-adapter to behave like the Node.js HTTP server or at least similar to it.
On Linux with
net.ipv6.bindv6only=0(which is the default),::supports both IPv4 and IPv6 via IPv4-mapped IPv6 addresses.So while NGINX happily uses both, and the Node.js
httpmodule's server by default does too (which Express uses under the hood), SvelteKit with the node adapter only supports IPv4, resulting in errors whenever NGINX uses IPv6 for a request.Changing the default to
::would allow for parity with Node.js and less issues for consumers since both IPv4 and IPv6 just work on most OSes.Beta Was this translation helpful? Give feedback.
All reactions