Skip to content

[Feature]: Remember this device behind a trusted HTTPS reverse proxy in standalone mode #8338

Closed

Description

@stanthewizzard

Area

Dashboard

What are you trying to accomplish?

I run independent OpenCodex standalone instances on Windows PCs. I access their dashboards from another PC or a phone through Caddy, using a dedicated HTTPS hostname per instance. Caddy requires a client certificate. It terminates TLS and connects to each OpenCodex instance over the private LAN.

I want to enter the OpenCodex admin token once, select Remember this device, and resume the dashboard after closing and reopening the browser. I want to keep each instance standalone.

What prevents this today?

With OpenCodex 2.99.0, signing in through this HTTPS reverse proxy works when Remember this device is unchecked. Checking it fails with the generic message The admin token could not be verified. Try again. The same admin token succeeds immediately when the checkbox is unchecked.

The remembered-device implementation requires direct same-origin HTTPS or loopback. An ordinary TLS-terminating reverse proxy does not satisfy this condition: the browser uses HTTPS, while OpenCodex observes HTTP. Forwarded headers do not establish the dedicated Hub management-listener trust context. The browser also validates the origins in the returned session metadata, so changing request headers alone is insufficient.

The limitation is understandable, but the UI offers the checkbox and reports an apparent credential failure instead of explaining the unsupported deployment.

What should OpenCodex do?

Provide an explicit, opt-in way for a standalone instance to support remembered-device sessions behind a trusted HTTPS reverse proxy, with one configured external dashboard origin and a narrowly defined trusted ingress.

The proxy should provide transport security; OpenCodex should continue to authenticate the admin token and issue its own remembered-device cookie, device proof and short-lived GUI sessions. Keep Origin/CSRF validation, the server-side expiry, revocation and existing restrictions on sensitive operations.

Untrusted clients must not be able to claim HTTPS or a local origin by supplying forwarded headers. A client certificate accepted by Caddy should not automatically grant an OpenCodex session or broader dashboard authority.

If the deployment cannot support Remember, disable the checkbox or show a specific explanation rather than reporting that a valid admin token could not be verified.

Example usage or interface

Deployment example (placeholder hostnames only):

Browser
  -> https://ocx.example.com (TLS + required client certificate)
  -> Caddy
  -> http://pc-a.internal:10100 (OpenCodex standalone)

Expected workflow:

  1. Configure the standalone instance's external HTTPS dashboard origin and explicitly trusted proxy ingress using a supported configuration mechanism.
  2. Open the HTTPS URL, enter the admin token and select Remember this device.
  3. Close the browser and reopen the same URL: the remembered device resumes an ordinary dashboard session without the raw admin token.
  4. Forget this device or log out: the old cookie/proof no longer resumes a session.
  5. Requests with a foreign Origin, untrusted proxy metadata, missing proof, or an expired/revoked record remain rejected.

Alternatives or workarounds

  • Leaving Remember unchecked works, but requires another sign-in after the browser session is lost.
  • Password-manager autofill helps with the token form, but does not provide remembered-device sessions.
  • Loopback tunnels add per-device setup and are awkward on mobile.
  • Switching to a Hub changes the deployment model solely to enable dashboard transport handling.
  • External proxy compatibility logic can work, but maintaining application-specific session-origin translation in the proxy is fragile. I would prefer a supported OpenCodex configuration and do not want to patch the installed application.

Additional context

In my environment, a proxy compatibility adapter passed a real Chrome test: remembered sign-in, resumption in a new browser context without the admin token, authenticated reads, logout and rejection of the old browser state. This is evidence that the desired workflow is useful and achievable, not a claim that OpenCodex currently supports this deployment natively.

Checks

  • I searched existing issues and documentation.
  • This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
  • I removed secrets and personal data.

Activity

  1. coderabbitai commented on Nov 8, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #7593 - feat(dashboard): revocable server-side remembered device sessions [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  2. added
    enhancement
    gui
    proxy
    on Nov 8, 2026
  3. Ingwannu commented on Nov 8, 2026

    @Ingwannu
    Owner

    Thanks for the precise write-up. Verified on origin/dev f8dfc2f.

    Why Remember fails behind a TLS terminator:

    • The server issues a remembered device only from a direct origin. directOrigin requires the request URL origin to match the origin the server derives, and the scheme must be https or loopback (src/server/persistent-gui-session.ts:26-38). Behind Caddy the request URL is http://, the host is not loopback, and rememberGuiDevice returns null (:101-103).
    • The server then answers 403 with "Remember requires a direct HTTPS dashboard (or loopback) and matching Origin" (src/server/management/session-routes.ts:9).
    • The dashboard does not show that message. canRememberDashboardDevice passes behind HTTPS (gui/src/api.ts:361-364), the POST is sent, and any response other than 401 becomes "unavailable" (gui/src/api.ts:473, :481-482). The dialog then shows "The admin token could not be verified" (gui/src/admin-token-dialog.ts:173, :181). That is the misleading message you saw.

    Scope:

    The narrower defect is clear: when the server refuses Remember, the dashboard should say so (or hide the checkbox) instead of reporting a valid admin token as unverified. A small GUI change for that is possible; it is not implemented yet.

  4. added 5 commits that reference this issue on Nov 8, 2026
  5. lidge-jun commented on Nov 8, 2026

    @lidge-jun
    Owner

    The narrow defect from the triage comment is fixed on dev by #8374 (c813ecc). When the server refuses Remember behind a TLS-terminating proxy, the sign-in dialog now explains that this address cannot remember the device, turns Remember off, and keeps the token so you can sign in without it. It no longer reports a valid admin token as unverifiable.

    The feature this issue asks for, remembered devices behind a trusted HTTPS reverse proxy in standalone mode, is a trust-boundary design decision for the maintainers and is not implemented. This issue stays open for it.

  6. lidge-jun commented on Nov 10, 2026

    @lidge-jun
    Owner

    Status check after the 11-09 revert: #8394's documentation was reverted by 0fac612a93 and re-landed unchanged by #8405 (9573456d59), with follow-up wording in #8418. It is on dev now (docs-site/src/content/docs/guides/web-dashboard.md "Remember this device" paragraph, and the remember_requires_direct_origin row in reference/management-api.md). The #8374 UX fix is unaffected.

    The feature itself, remembered devices for a standalone instance behind a trusted TLS-terminating proxy, adds a new trust boundary, so it needs an owner decision before anyone implements it. Options:

    1. Keep the refusal (current, documented). There is no new trust surface, and Remember stays unavailable behind a proxy.
    2. Explicit opt-in trusted ingress: one configured external dashboard origin, plus a trusted ingress that OpenCodex can verify (loopback-only or a named source address/CIDR for the proxy). X-Forwarded-Proto/Host would be honored only from that ingress, and Origin/CSRF, expiry, revocation, and consent restrictions would stay as they are. This needs a security review of the forwarded-header trust and tests showing that untrusted clients cannot claim HTTPS.
    3. Point users at the Hub management listener, which already supports Remember. This changes the deployment shape, which the reporter wants to avoid.

    Recommendation: 2, opt-in only, with its own security review. Otherwise 1.

  7. lidge-jun commented on Nov 11, 2026

    @lidge-jun
    Owner

    Decision (owner, 11-11): approved as an opt-in setting. Remember this device works on a standalone dashboard behind a reverse proxy only after the operator names the exact HTTPS origin, the proxy's own addresses, and which of Host / X-Forwarded-* to trust. Without the setting, behavior is unchanged (direct HTTPS or loopback only). Forged or contradicting X-Forwarded-* values, an origin that is not configured, HTTP origins, and wildcards are refused. Implementation follows in a PR for this issue, with a separate security review.

  8. added a commit that references this issue on Nov 12, 2026
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

    enhancementguiproxy

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions