awslabs / aws-api-gateway-developer-portal

A Serverless Developer Portal for easily publishing and cataloging APIs
Apache License 2.0
923 stars 399 forks source link

Developer Portal Custom Domain issue #468

Open neelananda opened 3 years ago

neelananda commented 3 years ago

We are using API gateway Developer Portal. All our APIs are API Gateway APIs. Everything is working fine with default cloudfront domain name but we have an issue, when we are using our own custom domain configured in cloudfront and setting origin as the developer portal. We followed the instructions mentioned here(https://github.com/awslabs/aws-api-gateway-developer-portal) to set-up the custom domain. To setup the custom domain new certificate and deployed through SAM as per the above link. The issue we are facing is that we are getting CORS error when we navigate to either Admin page or API page and none of the API data is getting populated.

It would be of great help, if some can guide us on this

neelananda commented 3 years ago

We are using API gateway Developer Portal. All our APIs are API Gateway APIs. Everything is working fine with default cloudfront domain name but we have an issue, when we are using our own custom domain configured in cloudfront and setting origin as the developer portal. We followed the instructions mentioned here(https://github.com/awslabs/aws-api-gateway-developer-portal) to set-up the custom domain. To setup the custom domain new certificate and deployed through SAM as per the above link. The issue we are facing is that we are getting CORS error when we navigate to either Admin page or API page and none of the API data is getting populated.

It would be of great help, if some can guide us on this

Yester day we found that when API gateway invoked Lambda function(Developer Portal) , Lambda function returning CORS header with value of default cloudfront domain instead of custom domain. We are trying to find out where the logic need to be changed to set the proper CORS value. Any help in this really appreciated

ghost commented 3 years ago

The relevant Lambda lives here and the CloudFormation template lives here. If you want to take a stab and file a pull request, we'd be more than willing to take a look at it. 🙂

lrfsh commented 3 years ago

Actually, if you update the Cloudformation it will update in the API GW - Integration Response - Header Mappings. The problem most likely is the Cloudformation template won't deploy the stage which was modified and that's why you will see that error. Just go to the API GW and deploy to the prod stage, it will work after few minutes.

gmmarc commented 2 years ago

Actually, if you update the Cloudformation it will update in the API GW - Integration Response - Header Mappings. The problem most likely is the Cloudformation template won't deploy the stage which was modified and that's why you will see that error. Just go to the API GW and deploy to the prod stage, it will work after few minutes.

Deploying prod stage from API Gateway worked for me. Thank you @lrfsh !