Skip to content

[Cookies] Match array-based cookie domains case-insensitively#328

Merged
rsamoilov merged 1 commit into
rage-rb:mainfrom
RedZapdos123:fix-cookie-array-domain-case-327
Jun 14, 2026
Merged

[Cookies] Match array-based cookie domains case-insensitively#328
rsamoilov merged 1 commit into
rage-rb:mainfrom
RedZapdos123:fix-cookie-array-domain-case-327

Conversation

@RedZapdos123

@RedZapdos123 RedZapdos123 commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Description:

Issue #327 reported that array-based cookie domains were matched with exact string equality, so uppercase request hosts did not match lowercase configured domains.

This PR updates Rage::Cookies#[]= to match array-based cookie domains case-insensitively while still using the configured domain value in the Set-Cookie header.

It also adds regression tests for uppercase hosts with and without a port, and updates CHANGELOG.md.

Closes #327.

Checklist:

  • I have added relevant regression test cases for this fix.
  • I have run linting checks in WSL using bundle exec rubocop --except Layout/EndOfLine lib/rage/cookies.rb spec/controller/api/cookies_spec.rb.
  • I have run focused tests in WSL using bundle exec rspec spec/controller/api/cookies_spec.rb.
  • I have run broader regression checks in WSL using bundle exec rspec spec/controller/api spec/router/constraints_spec.rb.

Before the fix:

image

After the fix:

image

Signed-off-by: Mridankan Mandal <xerontitan90@gmail.com>

@rsamoilov rsamoilov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks great 👍

@rsamoilov rsamoilov merged commit aa15f81 into rage-rb:main Jun 14, 2026
11 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.

[Cookies] Match array-based cookie domains case-insensitively

3 participants