feat: add SameSite=None support for Set-Cookie flags#3066
Open
rayshoo wants to merge 1 commit intobunkerity:devfrom
Open
feat: add SameSite=None support for Set-Cookie flags#3066rayshoo wants to merge 1 commit intobunkerity:devfrom
rayshoo wants to merge 1 commit intobunkerity:devfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds support for
SameSite=None(and other SameSite variants) to the cookie flag filter used by BunkerWeb/Nginx in order to prevent breakages in existing/legacy service environments where cross-site cookie flows are required.Background / Motivation
When applying BunkerWeb to an existing production service, we found that the current cookie flags mechanism does not allow configuring
SameSite=None.In real deployments, some authentication/session flows (e.g., cross-site SSO callbacks, embedded contexts, or other third-party scenarios) still rely on cookies being sent in a cross-site context. Without the ability to set
SameSite=None, cookies may be blocked by browsers and can cause user-facing outages (session loss, login loops, broken integrations).While
SameSite=LaxorSameSite=Strictare generally more secure and recommended, operators still need the ability to explicitly chooseSameSite=Nonefor compatibility during migration or for services that cannot immediately change their flow.Changes
set_cookie_flagdirective parsing to support:samesite=nonesamesite=laxsamesite=strictsamesite(value-less)samesite=laxandsamesite=stricttogether) and fail fast during config parsing.Set-Cookieheaders by cookie name, and allow default rules via*.*default configuration applied last (moved to the end of the array).Configuration Examples