Skip to content

web: reverse-proxy SSO expiry blanks the UI instead of redirecting to login #57649

Closed as duplicate

Description

@0xf3cd

Description

Since moving to V2, an open web tab sometimes stops showing content without navigating to our SSO login page. Signing in to Authelia separately in the same browser restores the content in OpenCode.

The deployment is browser -> Caddy + Authelia forward-auth -> opencode serve. Authelia protects the whole site, and Caddy supplies the backend's Basic authentication header.

Unauthenticated curl probes against the protected origin confirm:

  • GET /api/info, Accept: application/json: 401 with a Location header pointing to Authelia's login page.
  • GET /, Accept: text/html: 302 to that login page.

These probes suggest an expired proxy session, but we haven't captured the failing browser requests or verified the exact SSE reconnect sequence. The V1 comparison is based on deployment experience, not a side-by-side test. A plain page reload is not a verified workaround; the service worker may serve the cached app shell.

Expected: make the sign-in path available when proxy authentication expires instead of leaving the tab without content.

This overlaps with #50481; #52223 is the existing recovery PR.

Plugins

Not isolated with plugins disabled.

OpenCode version

2.1.1

Steps to reproduce

  1. Serve the web UI behind Caddy + Authelia forward-auth and sign in.
  2. Leave the tab open until the proxy session expires.
  3. The tab stops showing content without navigating to sign-in.
  4. Sign in to Authelia separately in the same browser. OpenCode content returns.

Operating System

Server: Linux x86_64, kernel 7.0.0-30-generic. Browser/OS details not collected.

Terminal

N/A, web UI.

Activity

  1. 0xf3cd commented on Oct 21, 2026

    @0xf3cd
    Author

    We run into this with opencode serve behind Caddy + Authelia, so we have a live reproduction environment. Happy to take it.

    Plan: when API/SSE requests start failing with 401 (or after a 302 lands on HTML instead of the expected payload), do a guarded one-shot page reload so the proxy's own redirect can take over. Will follow up with a PR referencing this issue.

  2. opencode-agent commented on Oct 21, 2026

    @opencode-agent
    Contributor

    Thanks for the detailed write-up and the curl probes. I think this is a duplicate of #50481. It describes the same failure behind oauth2-proxy/Keycloak: once the proxy's SSO session expires, background /api and /api/event requests get a 302 to the IdP (followed silently) or a 401. The client keeps retrying and never sends you to the login page.

    Possible duplicates and related issues, ordered from most to least likely:

    Your notes on the Accept: application/json → 401 + Location case would be useful on #50481 or #52223, since that PR only checks for redirects.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  3. 0xf3cd commented on Oct 21, 2026

    @0xf3cd
    Author

    Agreed, the expired-proxy-session symptom overlaps with #50481. I'll add the Authelia 401 + Location evidence to #52223 rather than open a competing implementation.

    One correction to my initial report: curl confirmed the proxy responses, but I haven't captured a browser trace proving the SSE sequence. A plain reload is also not a verified workaround, since the service worker may serve the cached app shell. Signing in to Authelia separately is the workaround we've observed.

  4. opencode-agent commented on Oct 22, 2026

    @opencode-agent
    Contributor

    We haven't heard back in the past day, so I'm closing this as a duplicate of #50481. That issue covers the same problem: after the reverse proxy's SSO session expires, background API and SSE requests get a 401 or a silently followed redirect, and the web client never sends you back to the login page. Please follow #50481 and the open PR #52223 for updates. Your note on the Accept: application/json → 401 + Location case would be useful there. If your problem turns out to be different, reply here and we can reopen it. Thanks for the detailed report!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions