Skip to content
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

Modify access-control-allow-origin header on api request(Graphql) #710

Open
mdivani opened this issue Aug 4, 2022 · 4 comments
Open

Modify access-control-allow-origin header on api request(Graphql) #710

mdivani opened this issue Aug 4, 2022 · 4 comments
Assignees
Labels
api-graphql feature-request New feature or request

Comments

@mdivani
Copy link

mdivani commented Aug 4, 2022

We need to set cors rules on appsync to pass security checks but I was unable to find option to modify cors headers, is it even possible with amplify and appsync?

@mdivani mdivani added the question Further information is requested label Aug 4, 2022
@josefaidt josefaidt transferred this issue from aws-amplify/amplify-cli Aug 4, 2022
@josefaidt
Copy link
Contributor

josefaidt commented Aug 4, 2022

Hey @mdivani 👋 thanks for raising this! Unfortunately this is not currently possible today. What, if anything particular, are you wanting to customize with the current CORS behavior?

@JonMGC
Copy link

JonMGC commented Nov 17, 2022

Hey Team. We are also quite keen on having this feature for AppSync. We can work around it with a Cloudfront Distribution but it would be simplier if we were able to override the '*' access control header by using $util.http.addResponseHeader(), which at the moment appears to be blocked. In our case we just wish to limit who can call the API in the browser to a limited list of domains rather than allowing everyone.

@jamesclancy
Copy link

@JonMGC is there any documentation for how you did this with a cloudfront distribution?

@JonMGC
Copy link

JonMGC commented Mar 18, 2023

@jamesclancy You can set AppSync API as an origin for Cloudfront, then modify the Access-Control-Allow-Origin header: https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/modifying-response-headers.html

Just to clarify this is for a Cloudfront distribution provisioned through CDK. I am not sure if/how you can do this with Amplify.

@josefaidt josefaidt added feature-request New feature or request api-graphql and removed question Further information is requested pending-triage pending-response labels May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-graphql feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants