feat(desktop): open ports over https via ports.json protocol field
What
Adds an optional protocol field ("http" | "https") to each entry in a
workspace's .superset/ports.json. When set to "https", the sidebar's
port-open action opens https://localhost:PORT instead of http://.
{
"ports": [
{ "port": 3000, "label": "Frontend Dev Server", "protocol": "https" },
{ "port": 8080, "label": "API Server" }
]
}
Why
Port open actions were hardcoded to http://localhost:PORT
(usePortOpenActions.ts, MergedPortBadge.tsx). Dev servers running behind a
local TLS cert (e.g. mkcert) 301/refuse on http://, so opening them from
the sidebar lands on a broken page and you have to retype the URL with
https://. There was no config or preference to control the scheme.
This rides the same rails the existing label field already uses, so it's
purely additive and backward compatible — omit protocol and behavior is
unchanged (defaults to http).
How
protocol is resolved from ports.json alongside label and travels the two
existing paths that carry label to the renderer:
- Query path:
parseStaticPortsConfig→ static-port label caches (desktop- host-service) →
ports.getAllenrichment →EnrichedPort/
DashboardSidebarPort.
- host-service) →
- Event path: host-service
port:changedbroadcast →workspace-client
PortChangedPayload→applyPortEventsToHostPortsResult.
Both the v2 sidebar (usePortOpenActions) and the v1 sidebar
(MergedPortBadge) then build the URL as
`${port.protocol ?? "http"}://localhost:${port.port}`.
The label caches' Map<number, string> (port → label) becomes
Map<number, StaticPortLabel> so the same lookup yields both label and
protocol.
Validation
parseStaticPortsConfig rejects any protocol that isn't exactly "http" or
"https" with ports[N].protocol must be "http" or "https", consistent with
the existing per-field error messages. Malformed files are still ignored
wholesale (unchanged behavior).
Testing
bun run typecheckbun run lintbun run test— added cases:static-portsloader: loadshttps/http, omits when absent, rejects an
invalid protocol.applyPortEventsToHostPortsResult: carriesprotocolfrom an add event
onto the port row.
Notes
- Backward compatible: entries without
protocolserialize and behave exactly
as before (toEqualon existing loader fixtures is unchanged). - Docs updated:
apps/docs/content/docs/ports.mdx. - Happy to split or convert to an issue-first discussion if you'd prefer — kept
it to one focused change per the contributing guide.
Summary by cubic
Add optional HTTPS support for sidebar port-open actions via a new protocol field in .superset/ports.json. Defaults to HTTP, so existing configs work unchanged.
- New Features
- Add
protocol("http" | "https") to.superset/ports.json; when set to "https", ports open athttps://localhost:PORT. - Thread
protocolthrough label cache, hostport:changedevents, TRPC, and renderer; exposed onEnrichedPortandPortChangedPayload. - Update open actions in
usePortOpenActionsandMergedPortBadgeto useprotocol ?? "http". - Validate values in
@superset/port-scanner; tests and docs updated.
- Add
Summary by CodeRabbit
- New Features
- Added optional per-port protocol settings for
httporhttps. - Port listings and live updates now retain and display protocol information.
- Opening a port now uses its configured protocol, defaulting to HTTP.
- Added optional per-port protocol settings for
- Bug Fixes
- Improved handling of missing or invalid protocol values.
- Documentation
- Updated port configuration guidance with protocol examples and HTTPS behavior.
- Tests
- Added coverage for valid, missing, and invalid protocol configurations.