-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix: allow regex support for Access-Control-Allow-Origin (#4470) #5077
Conversation
…ow-Origin (apollographql#4470) fix(apollo-server-cloud-functions): allow regex support for Access-Control-Allow-Origin (apollographql#4470)
@prescottprue: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
@apollo-cla - signed |
Hi @prescottprue. I'm getting more and more convinced that building out a miniature implementation of every express plugin inside Also considering making CORS in general something that you configure outside of AS just like for any other web app instead of built-in. See #4859 . Of course this only works for Lambda if we also do #5078. So I'm not sure that expanding this API is the best idea right now. |
@glasser Thanks for the quick response. Totally makes sense about not expanding the API given the goal of v3 - saw your comment and am looking forward to it |
Thanks for the PR @prescottprue! I am trying to use RegEx to configure a wildcard RegEx domain like @glasser I think your comment above makes sense, but I wonder if it also makes sense to merge this PR as there is a real use-case for this and I am not sure how far apollo-server 3 is from being ready? I found this PR because the documentation says
but the cors configuration it links to (https://github.com/expressjs/cors#configuration-options) says that RegEx are supported I might end up forking this repo and apply this PR to use it for now which I don't like |
FWIW, you can combine |
@glasser Hi there. Have you guys considered adding this functionality for Apollo Server 3? Thanks |
@jessgoldq4 In AS3 we already did the thing I theorized above:
In Apollo Server 4 we are moving even further in the direction of "it's not Apollo Server's job to take in configuration that is immediately passed to another library" and unbundling cors configuration. The Lambda integration will get its cors configuration ... well, there might be multiple Lambda integrations. One built on top of express + |
Description
Adds support for Regex and Regex within an array for
cors.origin
setting in apollo-server-lambda and apollo-server-cloud-functions to match configuration option offered by ExpressFixes
Access-Control-Allow-Origin
(closes [apollo-server-lambda] allow regex support for Acess-Control-Allow-Origin #4470)Access-Control-Allow-Origin
(closes [apollo-server-lambda] allow regex support for Acess-Control-Allow-Origin #4470)Notes
apollo-server-lambda
has a variable holding the request origin, so I mirrored this withinapollo-server-cloud-functions
cors.origin
in either package - going to look into adding, but wanted to confirm this in an intended change firstOpen Questions