fix(webui): allow LAN access when host is 0.0.0.0
The webui bootstrap endpoint (/webui/bootstrap) rejected all non-localhost connections with HTTP 403, preventing the embedded webui from working when accessed from another device on the LAN — even when host was set to 0.0.0.0. Skip the localhost check when the server is explicitly bound to 0.0.0.0 or ::, since that signals intent to accept external connections.
This commit is contained in:
@@ -607,7 +607,9 @@ class WebSocketChannel(BaseChannel):
|
||||
self._api_tokens.pop(token_key, None)
|
||||
|
||||
def _handle_webui_bootstrap(self, connection: Any) -> Response:
|
||||
if not _is_localhost(connection):
|
||||
if self.config.host not in ("0.0.0.0", "::") and not _is_localhost(
|
||||
connection,
|
||||
):
|
||||
return _http_error(403, "webui bootstrap is localhost-only")
|
||||
# Cap outstanding tokens to avoid runaway growth from a misbehaving client.
|
||||
self._purge_expired_issued_tokens()
|
||||
|
||||
Reference in New Issue
Block a user