Skip to content

fix: skip Secure cookie flag for admin session on localhost#130

Closed
jkleinne wants to merge 1 commit intoBigBodyCobain:mainfrom
jkleinne:fix/admin-session-cookie-localhost
Closed

fix: skip Secure cookie flag for admin session on localhost#130
jkleinne wants to merge 1 commit intoBigBodyCobain:mainfrom
jkleinne:fix/admin-session-cookie-localhost

Conversation

@jkleinne
Copy link
Copy Markdown

@jkleinne jkleinne commented Apr 4, 2026

Summary

Fixes #129 — the admin session cookie's Secure flag prevents it from being sent over plain HTTP on localhost, making the API Keys panel (and other admin-gated settings) inaccessible for self-hosted users.

  • Adds an isLoopback() helper that checks if the request's Host header is localhost, 127.0.0.1, or ::1
  • Passes the request to cookieOptions() so it can skip the Secure flag on loopback
  • Non-localhost deployments (including LAN IP and domain-based access) are unaffected — Secure is still set in production

Test plan

  • Built local frontend Docker image with the fix
  • Verified cookie no longer has Secure flag on http://localhost:3000
  • Verified API Keys tab populates after UNLOCK on localhost
  • Verify cookie still has Secure flag when accessed via non-loopback hostname

The admin session cookie is set with `secure: true` when
NODE_ENV=production. Since the Docker image runs in production mode,
browsers silently drop the cookie over plain HTTP, making the API Keys
panel and other admin-gated settings inaccessible on localhost.
@jkleinne
Copy link
Copy Markdown
Author

jkleinne commented Apr 4, 2026

Closing - this was fixed upstream in ea457f2. Thanks for the quick turnaround! Happy the issue report helped surface it.

@jkleinne jkleinne closed this Apr 4, 2026
@BigBodyCobain
Copy link
Copy Markdown
Owner

I wish I saw this earlier. I just literally fixed this. THank you though!

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.

Admin session cookie Secure flag breaks API Keys panel on localhost

2 participants