-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Improve support for port numbers in allowedOriginPattern of CorsConfiguration #26927
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
Improve support for port numbers in allowedOriginPattern of CorsConfiguration #26927
Conversation
More tests added. Closes spring-projectsgh-26926
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.
It would be nice if a description of the added patterns was added to the document of the setAllowedOriginPatterns()
method.
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.
Thanks for the PR. This looks good overall.
One observation. It looks like I can now match an implicit port (e.g. "https://abc.org"
) or any port (including an implicit port) with "*"
, but if I want to match both implicit and specific others, then I need two patterns. I suppose if one defines "https://abc.org:[8080,8081]"
it's impossible to know just by looking whether it matches the implicit port or not, but it's probably best to err on the side of allowing less.
In summary I agree with the way you've done it. However, we'll need to make sure the syntax and these nuances are covered well in CorsConfiguration#setAllowedOriginPatterns
. Let me know if you intend to do that or otherwise I can take it from there.
@rstoyanchev sure, I can add some documentation on that. |
Documentation added. Closes spring-projectsgh-26926
@rstoyanchev I've added some documentation, can you review please? |
This is to support ports in cors origin patterns.
Closes gh-26926
Example: