feat(ext/node): support DENO_SERVE_ADDRESS override in node:http servers#34662
Merged
Conversation
Add a `listen()` override on `http.Server` (and `https.Server`) that honors the process-wide serve address override (DENO_SERVE_ADDRESS) so node:http servers behave like the top-level Deno.serve(): * Without `duplicate`: the first server to call `listen()` consumes the override. For TCP overrides the listen() args are rewritten in place. For unix/vsock/tunnel overrides the app-supplied TCP listen is skipped and a Deno listener is opened on the override address only. * With `duplicate`: the app-supplied address is used AND an additional override listener is started in parallel, regardless of transport. Non-TCP override listeners accept Deno.Conn connections and feed them to the HTTP server's normal connection listener via a lightweight Duplex wrapper, so the llhttp parser and the rest of the node:http pipeline handle the request the same way they would for a native TCP connection. Adds specs covering TCP override, TCP duplicate, unix duplicate, unix override-only, and https duplicate paths.
bartlomieju
added a commit
that referenced
this pull request
Jun 5, 2026
…rving (#34949) Upstream PR #34662 landed the `DENO_SERVE_ADDRESS` override for `node:http`/`node:https`, and PR #34676 wired `Deno.serve()` to call `op_http_notify_serving()` so that `DENO_AUTO_SERVE` setups can wait for a "Serving" event over `DENO_UNSTABLE_CONTROL_SOCK`. Node servers were left out: they observed the override address but never fired the notification, so a control plane waiting on the socket would hang. This hooks `notifyAddressOverrideServing()` into the `listen()` path of both `http.Server` and `https.Server` (and into `startOverrideListener` for non-TCP override transports) so `node:http` servers fire the same notification that `Deno.serve()` does. The unconfigured spec gains a `node:http` variant exercising the full `DENO_AUTO_SERVE` + `DENO_SERVE_ADDRESS=duplicate,unix:...` + `DENO_UNSTABLE_CONTROL_SOCK` flow. Co-authored-by: Avocet <[email protected]>
littledivy
pushed a commit
to crowlKats/deno
that referenced
this pull request
Jun 10, 2026
…ers (denoland#34662) The top-level `Deno.serve()` already honors the process-wide `DENO_SERVE_ADDRESS` override, but node:http servers ignored it, so an application using the Node compatibility layer could not be transparently rebound to a unix/vsock/tunnel control plane the way native Deno servers can. This matters for environments like Deno Deploy and the desktop runtime where the serve address is injected via the environment. This adds a `listen()` override on `http.Server` and `https.Server` that consumes the same override the first time a server binds. TCP overrides rewrite the listen address in place. For unix/vsock/tunnel overrides the server either listens on the override address only (default) or on both the app-supplied address and the override (`duplicate`). Non-TCP override connections are wrapped in a lightweight Duplex around `Deno.Conn` and fed into the normal connection listener, so the llhttp parser and the rest of the node:http pipeline handle them exactly like a native TCP connection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The top-level
Deno.serve()already honors the process-wideDENO_SERVE_ADDRESSoverride, but node:http servers ignored it, so anapplication using the Node compatibility layer could not be transparently
rebound to a unix/vsock/tunnel control plane the way native Deno servers
can. This matters for environments like Deno Deploy and the desktop
runtime where the serve address is injected via the environment.
This adds a
listen()override onhttp.Serverandhttps.Serverthatconsumes the same override the first time a server binds. TCP overrides
rewrite the listen address in place. For unix/vsock/tunnel overrides the
server either listens on the override address only (default) or on both
the app-supplied address and the override (
duplicate). Non-TCP overrideconnections are wrapped in a lightweight Duplex around
Deno.Connand fedinto the normal connection listener, so the llhttp parser and the rest of
the node:http pipeline handle them exactly like a native TCP connection.