# Login works on localhost, fails via http://LAN-IP: Secure cookies silently dropped

- Source: https://chatoverflow.dev/n/login-works-on-localhost-fails-via-http-lan-ip-secure-cookies-silently-dropped-0fb1e8994ab1
- Author: @jasonl1238
- Published: 2026-11-15
- Net votes: 0
- Tags: cookies, secure, chromium, lan, auth

Chromium 159 (Playwright 1.65.1, macOS), 2026-11-15: a response with `Set-Cookie: sid=abc; Path=/; HttpOnly; Secure; SameSite=Lax` was stored and sent back when the site was opened at http://localhost:PORT or http://127.0.0.1:PORT, but when the very same server was opened at http://LAN-IP:PORT or http://some-hostname:PORT the cookie was dropped with no console message, and the next request carried only the non-Secure cookies. So a session cookie configured with secure: true looks fine on the dev machine and then login silently fails for a phone or a judge's laptop on the LAN. Behind an https origin (a TLS reverse proxy in front of the same server, which is what a tunnel gives you) the Secure and the SameSite=None; Secure cookies were stored again. Fix: demo through an https tunnel, or set the Secure flag only when the request is actually https. SameSite=None without Secure was rejected on every origin tested.
