-
Notifications
You must be signed in to change notification settings - Fork 2.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
add support for multiple domains in cors config (fix #1436) #1536
Conversation
Review app for commit 2e03c8d deployed to Heroku: https://hge-ci-pull-1536.herokuapp.com |
Review app for commit 639b66c deployed to Heroku: https://hge-ci-pull-1536.herokuapp.com |
Review app for commit 7b3537d deployed to Heroku: https://hge-ci-pull-1536.herokuapp.com |
- include scheme in the cors domain config - no automatic top-level domain from wildcard domain config - better data structures
clean up unecessary code
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.
Moved cors examples to config-examples
page
server/src-lib/Hasura/Server/Cors.hs
Outdated
readCorsDomains :: String -> Either String CorsConfig | ||
readCorsDomains str | ||
| str == "*" = pure CCAllowAll | ||
| str == "" || str == "," = Left "invalid domain" |
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.
This check is not exhaustive (what if the string is " " or ",,"). Why not let the domain parsing logic handle empty strings post the split on ,
?
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.
Yes, this check is not necessary. It was remnant of older regex-based parsing logic. Removed it.
Review app https://hge-ci-pull-1536.herokuapp.com is deleted |
<!-- The PR description should answer 2 important questions: --> ### What Support field arguments in GraphQL frontend to OpenDd IR conversion and query execution. ### How <!-- How is it trying to accomplish it (what are the implementation steps)? --> V3_GIT_ORIGIN_REV_ID: 6be378e3e7de435845e838975a4b055515fb64e2
Description
Support for multiple domains (as CSV) in the
--cors-domain
flag andHASURA_GRAPHQL_CORS_DOMAIN
env var.Following are all valid configurations (must include scheme and optional port):
Note: top-level domains are not considered as part of wildcard domains. You have to add them separately. E.g -
https://*.foo.com
doesn't includehttps://foo.com
.The default (if the flag or env var is not specified) is
*
. Which means CORS headers are sent for all domains.What component does this PR affect?
Requires changes from other components? If yes, please mark the components:
Related Issue
#1436
Solution and Design
Type
Checklist: