Call ECS GraphQL Endpoint without CORS


I’m looking to deploy a GraphQL service through ECS, I’m curious as to the patterns recommended in order to call this service from a serverless based NextJS application.

The problem I’m trying to come up with a solution for is how to manage a path to GraphQL from the application itself without exposing the service over CORS. Ideally, the /graphql endpoint would exist on the same domain as my serverless nextjs application and be routed properly to the ECS based backend.

Any tips on how to accomplish this would be much appreciated, thanks!

hi jkupcho,
Were you able to identify a solution for this. Ideally my approach would be have a separate backend servers and technically its possible to have a fullstack with Nextjs. Given the opportunity I would like to have my graphQL service completely separated and host it as a separate serverless lambda (with APIGW as proxy to my graphQL apollo) . The only reason I would like to follow this pattern is because I do want my backend changes to be independent of my frontend. Not sure if you are looking for this or if you already found a better solution