Skip to content

feat(server): add --host / SIDESHOW_HOST to bind one address#232

Open
snevesgraca-nwmo wants to merge 1 commit into
modem-dev:mainfrom
snevesgraca-nwmo:feat/bind-address
Open

feat(server): add --host / SIDESHOW_HOST to bind one address#232
snevesgraca-nwmo wants to merge 1 commit into
modem-dev:mainfrom
snevesgraca-nwmo:feat/bind-address

Conversation

@snevesgraca-nwmo

Copy link
Copy Markdown

What

serve gains --host (and SIDESHOW_HOST) to bind a single address. The startup line now reports the address actually bound.

Why

server/index.ts calls serve({ fetch, port }) with no hostname, so @hono/node-server falls through to node's default and listens on every interface — while the startup line prints sideshow listening on http://localhost:PORT unconditionally. The one place a user might notice says the opposite of what happened.

This surfaced running sideshow on a shared dev host: ss -tlnp showed *:8228, and a curl from a container on the same box got a real HTTP response. SIDESHOW_TOKEN is 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 a hostname the underlying library already accepts.

Behaviour

The default is unchanged: unset means hostname: undefined, i.e. every interface — what containers and LAN-shared instances need.

invocation binds startup line
sideshow serve all interfaces http://localhost:8228 (all interfaces — set SIDESHOW_HOST to restrict)
sideshow serve --host 127.0.0.1 loopback http://127.0.0.1:8228
SIDESHOW_HOST=127.0.0.1 sideshow serve loopback http://127.0.0.1:8228

--host wins over SIDESHOW_HOST. IPv6 literals are bracketed in the startup line.

Notes

  • Three files: the flag in bin/sideshow.js (parsed alongside --port, forwarded as env), the bind in server/index.ts, and a minor changeset.
  • --host is in HELP; SIDESHOW_HOST is in the environment: block.
  • Gates run locally: lint, format:check, typecheck, changeset:status (minor), test (428 pass).

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant