Skip to content

Self-hosted HTTPS server with a local CA is shown as unreachable #1290

Done

Description

@Pavior0

The app can't connect to a self-hosted OpenCode server over HTTPS when the certificate is signed by a local CA that macOS trusts. The server shows as unreachable.

What happens

  • Browser and curl reach the server on the same machine. curl gets 401 without the token, and the expected JSON with it.
  • The app shows the server as unreachable. A pairing link for the same HTTPS URL fails too.
  • There is no log for the TLS error; the health check only says unreachable.

Why

The app only trusts the public root certificates it ships with, not the system trust store. The TLS handshake fails with invalid peer certificate: UnknownIssuer. The same HTTP client with the system verifier gets the normal 401/200 answers.

The event stream, pairing link redemption and terminal WebSocket use the same trust, so they fail too.

How to reproduce

  1. Put an OpenCode server behind HTTPS with a certificate from a local CA.
  2. Trust the CA in the system store; browser and curl work.
  3. Add the server in the app, or open a pairing link.
  4. The app shows it as unreachable.

OpenCode (Rune) 0.0.0-dev-492, macOS.

Activity

  1. Hona commented on Nov 27, 2026

    @Hona
    Member

    Fixed in #1124 (merged to dev in 3ba13ebf).

    What changed

    • Added the net-trust crate so every HTTPS request (server health probes, API requests, SSE event streams, pairing link redemption, plugins, and updater) and every wss:// WebSocket (terminal, MCP, and browser RPC tunnel) verifies certificates against both the compiled-in Mozilla roots (webpki-root-certs) and the operating system certificate store (rustls-native-certs, including macOS Keychain trust settings).
    • Added the scripts/guardrails/net-trust.mjs guardrail so new HTTP or WebSocket call sites cannot bypass the shared trust store.

    Verification

    • Verified: All 7 PR CI checks passed (guardrails, plan, build-macos, build-windows x64/arm64, build-linux x64/arm64), local pwsh scripts/guardrails.ps1 passed (10/10 including net-trust) on the merged dev tree, and PR fix(net): every HTTPS request and wss socket trusts the system certificate store's roots #1124 tested custom local CA trust on Linux and public/untrusted cert verification on Windows.
    • Not verified on hardware yet: Live macOS Keychain local-CA runtime test and live wss:// handshake with a local CA.

    Please reopen if a self-hosted HTTPS server with a macOS-trusted local CA still fails to connect on the next dev build.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions