通过 VPCLink 到 TargetGroup 的 HTTPAPI ALB 集成返回 500 错误

0

【以下的问题经过翻译处理】 你好,这是我的配置:

mydomain.com -> API GW Custom Domain -> HTTPAPI -> Route (/api/{+proxy}) -> VPCLink -> ALB -> HTTPS Listener -> TargetGroup (Type: Instance) -> ECS Fargate Service

HTTPAPI集成具有以下参数映射:path -> overwrite -> /$request.path.proxy(我想去掉url中的“api”部分)

当我提出以下请求时,我收到 500 个错误 https://mydomain.com/api/otherPath

我已启用 HTTPAPI 上的访问日志,但它们显示的信息非常有限。 ALB 日志发送到 S3 存储桶,因此几乎不可能跟踪请求。 据我所知,请求没有到达 Fargate 服务,但我不确定。

API GW HTTP API 的访问日志示例: ''' { "requestId": "some_req_id=", "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36", "sourceIp": "176.232..", "requestTime": "01/Nov/2022:09:25:37 +0000", "requestTimeEpoch": "1667294737", "httpMethod": "GET", "path": "/otherPath", "status": "500", "protocol": "HTTP/1.1", "responseLength": "35", "domainName": "mydomain.com", "error_Message": "Internal Server Error", "integrationErrorMessage": "-", "integration_Error": "-", "integrationStatus": "200", "integration_Status": "-", "integration_IntegrationStatus": "200", "integrationLatency": "5" } ''' 我缺少什么? 为什么很难找到导致错误的原因? 我认为配置很好,但不知何故很难让它工作。 难以置信!

1 回答
0

【以下的回答经过翻译处理】 该问题是由集成的 secureServerName 参数引起的。 我们希望在 API 网关和 ALB 之间创建安全连接。 提供 secureServerName 可以使该连接安全,但由于 API Gateway 使用集成的 (ALB) 证书来验证此 secureServerName,因此它会失败。 因此 secureServerName 必须与 ALB 证书中定义的主机名相同。

profile picture
专家
已回答 5 个月前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则