CloudFront + API Gateway AWS_IAM 授权

0

【以下的问题经过翻译处理】 我的API Gateway中有一个启用了AWS_IAM授权的终端节点。如果直接调用该终端节点,只要请求被正确签名,一切正常。

我正在尝试在它前面放置一个CloudFront分发,我已经配置了源和缓存行为;Authorization头已经列入白名单,并被转发到API Gateway。

当我尝试使用CloudFront URL调用终端节点时,我遇到了如下签名错误:

The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method.

我怀疑这个问题与以下事实有关:客户端对 CloudFront URL 请求进行了签名,但在 API Gateway/IAM 端检查签名时,url 并不匹配,是这样吗?

我错过了什么?我知道我可以使用Lambda@Edge重新签名请求,但由于我遵循了这些说明,因此应该可以在没有Lambda@Edge的情况下实现,对吗?

1 réponse
0

【以下的回答经过翻译处理】 我通过使用完全限定域名并将其设置为API Gateway上的自定义域名,这样就可以正常工作了。我在CloudFront分发中使用了相同的域,并确保转发使用了AWS_IAM保护的API端点的“host”头。

profile picture
EXPERT
répondu il y a 6 mois

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions