Skip to content

fix(auth): warn at startup when Secure cookies will break plain-HTTP LAN login#281

Merged
outsourc-e merged 1 commit intooutsourc-e:mainfrom
Interstellar-code:fix/auth-secure-cookie-lan-warning
May 4, 2026
Merged

fix(auth): warn at startup when Secure cookies will break plain-HTTP LAN login#281
outsourc-e merged 1 commit intooutsourc-e:mainfrom
Interstellar-code:fix/auth-secure-cookie-lan-warning

Conversation

@Interstellar-code
Copy link
Copy Markdown
Contributor

Summary

  • Adds a startup warning in server-entry.js when the server is running in production mode with a non-loopback bind address but without HTTPS
  • NODE_ENV=production enables the Secure flag on session cookies; browsers silently drop Secure cookies over plain HTTP, causing login to fail with no visible error on LAN deployments
  • Fix: log a clear warning pointing users to COOKIE_SECURE=0 as the escape hatch

Why

Silent login failure on LAN (HOST=0.0.0.0) with no error message is a sharp edge that's hard to diagnose. Closes #149.

Test plan

  • Start server with NODE_ENV=production HOST=0.0.0.0 (no COOKIE_SECURE=0) — warning appears in logs
  • Start server with NODE_ENV=production HOST=0.0.0.0 COOKIE_SECURE=0 — no warning
  • Start server with HOST=127.0.0.1 — no warning

Worked with Interstellar Code

…LAN login

NODE_ENV=production enables the Secure flag on session cookies. Browsers
silently drop Secure cookies over plain HTTP, causing login to fail with
no visible error when HOST=0.0.0.0 is used on a LAN without HTTPS.

- Add startup warning in server-entry.js when non-loopback host +
  production + COOKIE_SECURE not explicitly disabled
- Document COOKIE_SECURE=0 in .env.example alongside the existing =1 case
- Add COOKIE_SECURE entry to README env-vars table

Closes outsourc-e#149

Worked with Interstellar Code
CleanExpo added a commit to CleanExpo/hermes-workspace that referenced this pull request May 4, 2026
@outsourc-e outsourc-e merged commit b7e2339 into outsourc-e:main May 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document COOKIE_SECURE=false requirement for HOST=0.0.0.0 over plain HTTP

2 participants