API网关的自定义域返回403 [英] Custom domain for API Gateway returning 403

查看:409
本文介绍了API网关的自定义域返回403的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用API​​ Gateway和Lambda创建一个api。使用在API Gateway Stage编辑器中指定的url,一切都可以正常工作。但是,当我尝试移至自定义域时,遇到了一些问题。

I am creating an api using API Gateway and Lambda. Using the url designated in the API Gateway Stage editor everything works fine; however, when I try and move to a custom domain I am running into some issues.

我尝试做的第一件事是在Route 53中使用CNAME记录,直接从我的域到从API网关获得的域。那是返回一些错误,我认为这是不正确的解决方案,对吗?

The first thing I tried was using a CNAME record in Route 53 straight from my domain onto the domain that I got from the API Gateway. That was returning some errors and I think it is the incorrect solution is that correct?

接下来,我尝试了API Gateway中的自定义域名功能。我的理解是,这将汇总一个CloudFront发行版,然后可以从Route 53映射到该发行版。创建自定义域并添加域映射后,它为我提供了一个我认为是CloudFront发行版的URL。链接返回403响应,并且在CloudFront中未进行任何分配。调试此问题的好方法是什么?

Next I tried the Custom Domain Names feature in API Gateway. My understanding is this will roll up a CloudFront distribution that I can then map onto from Route 53. When I created the custom domain and added a Domain Mapping it provides me with a url to what I assume is a CloudFront distribution. The link is returning a 403 response and no distribution has been made in CloudFront. What is a good way of debugging this problem?

推荐答案

如果您还没有看到,请参阅此处的开发人员指南。 http://docs.aws.amazon.com /apigateway/latest/developerguide/how-to-custom-domains.html

Here is the developer guide if you haven't seen it. http://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-custom-domains.html

您需要做的就是设置一个CNAME,让您的DNS提供商指向在API网关为您提供的CF发行版中。您将无法直接对CF发行版进行API调用。 API网关通过您在API网关中设置的基本路径映射来映射API /阶段,因此只有针对域名的API调用才能正常工作。

All you need to do is set up a CNAME with your DNS provider pointing at the CF distribution that API Gateway gives you. You won't be able to make API calls directly to the CF distribution. API Gateway maps the API/stage from the Base Path mapping you set up in API Gateway so only API calls directed at the domain name will work correctly.

这篇关于API网关的自定义域返回403的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆