小编Chr*_*fer的帖子

API 网关代理到 VPC 链接

我正在尝试使用 API Gateway 将流量路由到内部网络负载平衡器。

到基本路径 (/) 的所有路由都正常工作,所以我知道 VPC 链接已启动并可访问。

我使用任何 http 方法添加了一个代理资源 (/{proxy+})。在我选择的任何“集成请求”中:

  • 集成类型:VPC 链接
  • 使用代理集成
  • 方法:任意
  • VPC 链接:我的 VPC 链接 (abcdefg)
  • 端点 URL:(即http://abcd1234.cloudfront.net/ {proxy})

我可以看到我的 Web 服务器响应重定向:

(b9d0c629-31ec-11e8-b452-0f13c3c62b81) Endpoint response body before 
transformations: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<title>Redirecting...</title>
<h1>Redirecting...</h1>
<p>You should be redirected automatically to target URL: <a href="http://abcd1234.cloudfront.net/api/">http://abcd1234.cloudfront.net/api/</a>. If not click the link.
(b9d0c629-31ec-11e8-b452-0f13c3c62b81) Method completed with status: 301
Run Code Online (Sandbox Code Playgroud)

网页显示:

{"message":"Forbidden"}
Run Code Online (Sandbox Code Playgroud)

此外,如果我尝试直接链接到 CloudFront URL,我会收到同样的错误。

除了 CloudFront URL,我还尝试了以下内容:

  1. 自定义域名

    403 禁地

  2. 我部署的阶段的 URL

    {"message": "内部服务器错误"} …

amazon-vpc aws-api-gateway elastic-load-balancer api-gateway

5
推荐指数
1
解决办法
3545
查看次数