-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
router: Allow CORS to be configured using typed_per_filter_config #9324
Conversation
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Makes sense to me at a high level. Will wait for CI to pass before taking a look. /wait |
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work. A few small comments.
/wait
// | ||
// This option has been deprecated. Please use `typed_per_filter_config` to configure | ||
// the CORS HTTP filter. | ||
CorsPolicy cors = 8 [deprecated = true]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs a note in deprecated.rst, same below
source/common/http/utility.cc
Outdated
std::vector<const Router::RouteSpecificFilterConfig*> | ||
Utility::resolveAllPerFilterConfigGeneric(const std::string& filter_name, | ||
const Router::RouteConstSharedPtr& route) { | ||
std::vector<const Router::RouteSpecificFilterConfig*> configs{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: {} not needed
source/common/http/utility.cc
Outdated
@@ -657,6 +657,16 @@ Utility::resolveMostSpecificPerFilterConfigGeneric(const std::string& filter_nam | |||
return maybe_filter_config; | |||
} | |||
|
|||
std::vector<const Router::RouteSpecificFilterConfig*> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perf nit: you might consider either an std::array of size 3 here, given that I think we know there can be a max of 3 entries? Or potentially for easier programming an absl::InlineVector of size 3 default storage?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooh, absl::InlineVector
looks pretty cool. Although since we're holding pointers, callers should ideally be verifying non-nullptr
anyways (as the cors filter does) so I think std::array
would suffice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
still need to finish addressing this before final review
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
Signed-off-by: Derek Argueta <[email protected]>
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Signed-off-by: Derek Argueta <[email protected]>
This pull request has been automatically marked as stale because it has not had activity in the last 7 days. It will be closed in 7 days if no further activity occurs. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
This pull request has been automatically closed because it has not had activity in the last 14 days. Please feel free to give a status update now, ping for review, or re-open when it's ready. Thank you for your contributions! |
Description: Enable the CORS filter to be configured using per-route filter configs. This is the first half of deprecating the CORS configuration in the router. While the router's
cors
field is working, we need to keep the CorsPolicy logic where the router can access it. Once we can delete thecors
field, we should consolidate all the CORS code in the CORS extension (left TODOs for myself).Risk Level: Low - new functionality, no change to existing functionality. The CORS filter will continue to use
ProtobufWkt::Empty
for it's main filter configuration to avoid breaking wire compatibility (which is being worked on in #8933) while the per-route filter configs have a new protobuf message that excludes deprecated fields.Testing: included (TODO update CORS integration tests)
Docs Changes: added
Release Notes: added
Fixes #8097
Deprecated:
envoy.api.v2.route.VirtualHost.cors
,envoy.api.v2.route.RouteAction.cors
Signed-off-by: Derek Argueta [email protected]