Skip to content

Let WebKit open the stream behind the PASSWORD login - #199

Closed
ehfd wants to merge 1 commit into
linuxserver:masterfrom
ehfd:socket-cookie-auth
Closed

ehfd wants to merge 1 commit into
linuxserver:masterfrom
ehfd:socket-cookie-auth

Conversation

@ehfd

@ehfd ehfd commented Nov 4, 2026

Copy link
Copy Markdown

linuxserver.io


  • I have read the contributing guideline and understand that I have made the correct modifications

  • An LLM assisted me in writing the code or text for this PR

  • An LLM agent wrote the code or text for this PR


Description:

With PASSWORD set, nginx's auth_basic guards every location. WebKit (Safari, Epiphany, GNOME Web) does not send the Basic credentials on a WebSocket handshake, so the page loads but the stream socket is answered 401 and the client loops on "WebSocket disconnected. Attempting to reconnect...". Chromium and Firefox send them and stream.

When PASSWORD is set, the page and pelorus locations now set an lsio_socket cookie (HttpOnly, SameSite=Strict, Secure on the 3001 block, path the SUBFOLDER) holding a random key init-nginx generates at start, and the api and pelorus locations take either the Basic login or that cookie (satisfy any with an auth_request to an internal location that compares it). The cookie is only set on a response that already passed auth_basic, so it authenticates nothing a Basic login could not. The new lines are commented like the existing auth_basic ones, so without PASSWORD the config is as before.

The hunks apply unchanged to ubunturesolute, alpine324, arch, fedora44, kali and dev; ubuntunoble, alpine323, fedora42, fedora43 and el9 differ at the api location. Every current variant's nginx (1.26 to 1.30) carries http_auth_request_module.

Benefits of this PR and context:

Safari users of any image behind PASSWORD get a black screen today. Selkies itself has the same fix for its own Basic login (selkies-project/selkies@d73346ea2, a signed selkies_socket cookie), but in these images nginx answers the handshake before it reaches Selkies, so it has to be done here.

How Has This Been Tested?

lscr.io/linuxserver/baseimage-selkies:debiantrixie with PASSWORD=test, stock and with the two changed files mounted, Playwright 1.55 (Chromium, Firefox, WebKit) logging in with HTTP credentials:

  • Stock: WebKit opened the stream socket 18 times in 15 s, received nothing and showed the reconnect message; Chromium and Firefox streamed.
  • Patched: WebKit, Chromium and Firefox all stream, on port 3000, on 3001 (TLS, cookie Secure) and under SUBFOLDER=/desk/ on both (cookie Path=/desk/).
  • Handshakes with curl on /api/websockets, patched: no credentials 401, wrong password 401, wrong cookie 401, Basic 101, the cookie alone 101 (stock: 401 for the cookie alone).
  • Without PASSWORD, patched: nginx -t passes, no new line is active, the page and the socket answer 200 and 101 without a login, and no cookie is set.

Source / References:

selkies-project/selkies@d73346ea2 (the same mechanism in Selkies for its own Basic login).

Copilot AI balanced review requested due to automatic review settings November 4, 2026 02:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

@ehfd
ehfd force-pushed the socket-cookie-auth branch from 8aa5a1a to 62b0ccb Compare November 14, 2026 13:11
@thelamer

Copy link
Copy Markdown
Member

We are dropping nginx soon and serving selkies directly see dev branch for reference

@thelamer thelamer closed this Nov 19, 2026
@LinuxServer-CI LinuxServer-CI moved this from PRs to Done in Issue & PR Tracker Nov 19, 2026
@ehfd
ehfd deleted the socket-cookie-auth branch November 19, 2026 15:14
@ehfd

ehfd commented Nov 19, 2026

Copy link
Copy Markdown
Author

Good.

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

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

3 participants