-
Notifications
You must be signed in to change notification settings - Fork 424
Allow for more CORS configuration #1594
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
Conversation
Motivation: We added some level of CORS configuration support in grpc#1583. This change adds further flexibility. Modifications: - Add an 'originBased' mode where the value of the origin header is returned in the response head. - Add a custom fallback where the user can specify a callback which is passed the value of the origin header and returns the value to return in the 'access-control-allow-origin' response header (or nil, if the origin is not allowed). Result: More flexibility for CORS.
private var checkOrigin: @Sendable (String) -> String? | ||
private let hashInto: @Sendable (inout Hasher) -> Void | ||
#if swift(>=5.7) | ||
private let isEqualTo: @Sendable (any GRPCCustomCORSAllowedOrigin) -> Bool |
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.
Do we get warnings if we don't use any
with new swift compilers?
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.
No; from what I can tell we get an error if the protocol has Self
or associatedtype
. We have that here via Equatable
.
Motivation: We added some level of CORS configuration support in grpc#1583. This change adds further flexibility. Modifications: - Add an 'originBased' mode where the value of the origin header is returned in the response head. - Add a custom fallback where the user can specify a callback which is passed the value of the origin header and returns the value to return in the 'access-control-allow-origin' response header (or nil, if the origin is not allowed). Result: More flexibility for CORS.
Motivation: We added some level of CORS configuration support in grpc#1583. This change adds further flexibility. Modifications: - Add an 'originBased' mode where the value of the origin header is returned in the response head. - Add a custom fallback where the user can specify a callback which is passed the value of the origin header and returns the value to return in the 'access-control-allow-origin' response header (or nil, if the origin is not allowed). Result: More flexibility for CORS.
Motivation:
We added some level of CORS configuration support in #1583. This change adds further flexibility.
Modifications:
Result:
More flexibility for CORS.