#5658·zellij

Web client: honor an identity header from a trusted reverse proxy (forward-auth / SSO)

Author: anthonyalayoCreated Sep 26, 2026Updated Sep 28, 2026
Labelsenhancement

Thanks for the great project! I gave your web client a shot, it fell short of expectations with security, and I have some ideas to help on that. What do you think?

My setup

I run OPNsense + Caddy + Authelia for SSO. Apps without their own SSO get Caddy in front with forward_auth: Caddy verifies the session against Authelia, then forwards the request with a trusted identity header (e.g. Remote-User / X-Auth-Remote-User). The app just says "if this request came from my trusted proxy and the proxy set a username header, I trust that as the user". Navidrome implemented exactly this (extauth), and it means every app in my stack is one SSO login away. Zellij's web client is the one app I can't fold into this pattern.

Where Zellij's web client is at odds with that setup

  • SSO can't log me in. The only input path is a human typing a token into the login modal (or zellij web --create-token). Caddy can authenticate me all day, but Zellij ignores every header the proxy sets — its auth is a local token DB + session cookie and nothing else. forward_auth gives the proxy an identity it has no way to hand to Zellij.
  • The token model doesn't map to an SSO user model. One shared token = one shared identity; per-user tokens = a manual issue/revoke lifecycle that duplicates what Authelia already owns. There's no way to say "Authelia user X = Zellij token Y".
  • The listener rules fight a proxy-fronted deployment. Zellij's web server defaults to 127.0.0.1 and refuses to listen on any non-loopback IP unless it's configured with its own TLS cert/key (self-terminating TLS). In my layout Caddy lives on a different machine than Zellij, so I'm forced to manage certificates inside Zellij for a connection where Caddy already terminates TLS. I'd just like Zellij to listen on a LAN IP over plain HTTP and let the proxy do TLS. This is the part that feels the haviest in practice.
Browser ──▶ Caddy (TLS + forward_auth → Authelia)
                 │  authenticated as anthony, sets identity header
                 ▼
           Zellij (needs: "I trust this header because the peer is my proxy")

The gap, and ways to close it

The gap: my proxy already knows who I am, and the app has no mechanism to receive that fact. I see several ways to close it, and I'm happy to defer to whichever you think fits the project — I'm just flagging that the gap exists and is real for anyone running SSO in front of Zellij:

  1. Trusted-proxy identity header (the Navidrome extauth shape): a small config surface — trusted proxy IP/CIDR list, header name, optionally a logout URL — and requests carrying that header from a listed source IP resolve to a user (mapped to a named token, auto-provisioned per-user token, or read-only mode, whatever you prefer). The trust boundary is the TCP peer, never the header, and the whole thing fails closed when the list is empty. Navidrome proves this is a small, maintainable surface.
  2. Native OIDC — more complete, more maintenance; the header route is the cheap 90% for people who already have an SSO proxy, and native OIDC can be a separate, bigger ask.
  3. Loosening the listener — allowing a non-loopback bind without self-terminating TLS when the operator declares they're behind a proxy. That alone would make a Caddy-only setup viable (still token-based), and it's probably the smallest piece of this.

Why core rather than plugin

The web server and its auth middleware live in the binary, and any of the above has to sit in the same request path as the cookie check. If you believe this can be a plugin instead, I'd be glad to hear what API that would need — but I don't think web-client request interception is exposed to plugins today.

I'm mindful of the maintenance overhead this implies (the template's point is well taken). Whatever lands, I'd expect it to be a small config surface plus one trust check — not a new auth stack. Happy to help test any shape of it against my Caddy/Authelia setup.