Skip to content

BB_SERVER_BIND_HOST is loopback-or-wildcard only; no way to bind a single private interface #1754

Description

@Joesirven

Summary

BB_SERVER_BIND_HOST accepts only 127.0.0.1 or 0.0.0.0. On a machine that runs anything besides bb, that forces a choice between "unreachable from my other devices" and "listening on every interface including the public one." The safe middle ground most people actually want, binding to a single private interface such as a tailnet address, is not expressible.

This is a feature request, so per CONTRIBUTING.md I am opening an issue rather than a pull request.

Current behavior

packages/config/src/env-vars.ts:21:

type ServerBindHost = "127.0.0.1" | "0.0.0.0";

Anything else is rejected during config parsing (env-vars.ts:99-105), and the default is loopback (env-vars.ts:363). docs/multiple-devices.md describes 0.0.0.0 as "for compatibility only," noting correctly that the public API is unauthenticated and permits command execution and file reads.

I want to be clear that the loopback default is right, and #1124 / PR #1125 were the correct call. This is not a request to change the default.

The gap

My server has a tailnet address (100.x.y.z on tailscale0) and a public interface. What I want is:

BB_SERVER_BIND_HOST=100.114.62.119   # tailnet only

That would make bb reachable from my other tailnet devices and from nowhere else, enforced by the kernel rather than by a firewall I have to maintain separately. It is strictly safer than 0.0.0.0 and strictly more useful than 127.0.0.1.

Today the closest I can get is 0.0.0.0 plus firewall rules, which means the unauthenticated API is bound to the public interface and the only thing standing in front of it is configuration I have to get right and keep right.

A concrete reason wildcard is worse than it looks

While setting this up I found nginx on my box already bound to 0.0.0.0:443 for an unrelated site, presenting a CloudFlare Origin certificate. Because it binds to all interfaces, it also answers on the tailnet address, which silently broke tailscale serve --https=443 — Tailscale never got the connection, and the client saw a certificate for the wrong issuer.

The general point: on a multi-purpose host, wildcard binds collide and produce confusing failures. Being able to name the interface avoids that entirely, for bb and for whatever else is running.

Workaround, for anyone finding this

Keeping the loopback default and putting Tailscale Serve in front works well and is what I settled on:

tailscale serve --bg --https=8443 http://127.0.0.1:38886

This has a real advantage over direct binding beyond the security one: it terminates TLS with a Let's Encrypt certificate, so the browser gets a secure context and the clipboard and microphone APIs work. Direct binding over plain HTTP does not, which is #1590.

So Serve is genuinely the better answer for tailnet users, and worth recommending more prominently. But it requires Tailscale specifically. For someone on a plain private LAN or a WireGuard mesh without a Serve equivalent, single-interface binding is the only way to get the same containment.

Suggested change

Accept any local IP address for BB_SERVER_BIND_HOST, validating that it belongs to an interface present on the host, and keep the existing startup security warning (apps/server/src/start-server.ts:212) for any non-loopback value. The type could widen to a validated string rather than the current two-value union.

Activity

  1. added
    remote
    on Aug 18, 2026
  2. lanjak commented on Nov 12, 2026

    @lanjak
    Contributor

    Still present on main at 030b1b729: packages/config/src/env-vars.ts:33 still declares type ServerBindHost = "127.0.0.1" | "0.0.0.0", and parseServerBindHost (line 153) rejects any other address. One option: accept any literal IP address in parseServerBindHost, and keep loopback as the default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    remote

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions