Skip to content

feat(cookie): prevent aggressive session cookie expiration#284

Merged
hardy-dev-infinilabs merged 3 commits intomainfrom
limit_max_cookie_size
Apr 30, 2026
Merged

feat(cookie): prevent aggressive session cookie expiration#284
hardy-dev-infinilabs merged 3 commits intomainfrom
limit_max_cookie_size

Conversation

@medcl
Copy link
Copy Markdown
Member

@medcl medcl commented Apr 24, 2026

What does this PR do

Introduce a threshold-based cleanup mechanism for session cookies. Check the Cookie header size first and only trigger cleanup when it exceeds 6 KB, leaving headroom before the 8 KB browser/server limit. This ensures that:

  • 2–3 services on localhost: cookies coexist fine, all sessions survive, no logout
  • Many services / cookie bloat: cleanup kicks in to prevent the 8192-byte overflow, expiring foreign session cookies as a last resort

The tradeoff is intentional — you only lose foreign sessions when the alternative would be broken requests from header overflow.

Rationale for this change

Standards checklist

  • The PR title is descriptive
  • The commit messages are semantic
  • Necessary tests are added
  • Updated the release notes
  • Necessary documents have been added if this is a new feature
  • Performance tests checked, no obvious performance degradation

@medcl medcl changed the title fix(cookie): prevent aggressive session cookie expiration feat(cookie): prevent aggressive session cookie expiration Apr 24, 2026
@hardy-dev-infinilabs hardy-dev-infinilabs merged commit af13620 into main Apr 30, 2026
4 checks passed
@hardy-dev-infinilabs hardy-dev-infinilabs deleted the limit_max_cookie_size branch April 30, 2026 01:07
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.

3 participants