Skip to content

cors filter: add vary origin header #38868

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

surki
Copy link
Contributor

@surki surki commented Mar 24, 2025

Commit Message: cors filter: add vary origin header
Additional Description:
Risk Level: Low
Testing:
Docs Changes:
Release Notes:
Platform Specific Features:
[Optional Runtime guard:]
[Optional Fixes #35873]
[Optional Fixes commit #PR or SHA]
[Optional Deprecated:]
[Optional API Considerations:]

@surki surki requested a review from wbpcode as a code owner March 24, 2025 13:43
@surki surki force-pushed the cors-vary-header branch from 3531e01 to 6820932 Compare March 24, 2025 13:46
Signed-off-by: Suresh Kumar Ponnusamy <[email protected]>
Signed-off-by: Suresh Kumar Ponnusamy <[email protected]>
@surki surki force-pushed the cors-vary-header branch from 6820932 to 4deeb46 Compare March 24, 2025 13:49
Signed-off-by: Suresh Kumar Ponnusamy <[email protected]>
Signed-off-by: Suresh Kumar Ponnusamy <[email protected]>
Comment on lines +197 to +200
// Add Vary: Origin header when origin is not "*"
if (latched_origin_ != "*") {
headers.appendCopy(Http::CustomHeaders::get().Vary, "origin");
}
Copy link
Member

Choose a reason for hiding this comment

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

What will happen if the upstream reponse header has set vary:origin ?

I think you can take the CompressorFilter::insertVaryHeader of /source/source/extensions/filters/http/compressor/compressor_filter.cc as an example about how to update the vary origin.

Copy link
Member

@wbpcode wbpcode left a comment

Choose a reason for hiding this comment

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

Thanks for your contribution and one comment is added. And please also check the CI. :)

@wbpcode
Copy link
Member

wbpcode commented Mar 26, 2025

/wait

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Should envoy add "Vary: Origin" response header by default?
2 participants