feat(server): add --host / SIDESHOW_HOST to bind one address#232
Open
snevesgraca-nwmo wants to merge 1 commit into
Open
feat(server): add --host / SIDESHOW_HOST to bind one address#232snevesgraca-nwmo wants to merge 1 commit into
snevesgraca-nwmo wants to merge 1 commit into
Conversation
serve() was called with no hostname, so node listened on every interface, and the startup line printed "localhost" unconditionally — hiding that. There was no flag or env var to restrict it. The default is unchanged (every interface: what containers and LAN-shared instances need). --host / SIDESHOW_HOST binds one address, and the startup line now reports the address actually bound, calling out the wildcard case. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
What
servegains--host(andSIDESHOW_HOST) to bind a single address. The startup line now reports the address actually bound.Why
server/index.tscallsserve({ fetch, port })with nohostname, so@hono/node-serverfalls through to node's default and listens on every interface — while the startup line printssideshow listening on http://localhost:PORTunconditionally. The one place a user might notice says the opposite of what happened.This surfaced running sideshow on a shared dev host:
ss -tlnpshowed*:8228, and a curl from a container on the same box got a real HTTP response.SIDESHOW_TOKENis a single shared secret and doesn't cover the case where you'd simply rather the port not be on the network at all. With no flag or env var at any released version, the fallback was an nftables rule dropping non-loopback traffic to the port — a kernel firewall standing in for ahostnamethe underlying library already accepts.Behaviour
The default is unchanged: unset means
hostname: undefined, i.e. every interface — what containers and LAN-shared instances need.sideshow servehttp://localhost:8228 (all interfaces — set SIDESHOW_HOST to restrict)sideshow serve --host 127.0.0.1http://127.0.0.1:8228SIDESHOW_HOST=127.0.0.1 sideshow servehttp://127.0.0.1:8228--hostwins overSIDESHOW_HOST. IPv6 literals are bracketed in the startup line.Notes
bin/sideshow.js(parsed alongside--port, forwarded as env), the bind inserver/index.ts, and aminorchangeset.--hostis inHELP;SIDESHOW_HOSTis in theenvironment:block.lint,format:check,typecheck,changeset:status(minor),test(428 pass).🤖 Generated with Claude Code