为 public(匿名用户)配置 aws API 网关
Configure aws API gateway for public (anonymous user)
我将 AWS API 网关设置为 public,我正在尝试在本地主机服务器中测试它
但是我得到了这个错误
{
Message: 'User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:ap-northeast-2:********8648:vftnbscanh/test/POST/sms/send/'
}
用这个headers
error.response.headers
{
date: 'Sun, 04 Apr 2021 09:07:17 GMT',
'content-type': 'application/json',
'content-length': '170',
connection: 'close',
'x-amzn-requestid': '9e30546f-d9a2-4091-bd08-1635b6c8eca0',
'x-amzn-errortype': 'AccessDeniedException',
'x-amz-apigw-id': 'dQE25FsiIE0FsOA='
}
HUMMM 我以为我配置得很好检查我的配置。
根据评论。
问题是由不正确的API基于资源的策略引起的。默认情况下,new API 是 public 并且没有任何策略。但是由于 API 是通过复制现有的创建的,因此现有策略禁止 public 访问。
删除策略并重新部署 API 阶段可以解决问题。
我将 AWS API 网关设置为 public,我正在尝试在本地主机服务器中测试它
但是我得到了这个错误
{
Message: 'User: anonymous is not authorized to perform: execute-api:Invoke on resource: arn:aws:execute-api:ap-northeast-2:********8648:vftnbscanh/test/POST/sms/send/'
}
用这个headers
error.response.headers
{
date: 'Sun, 04 Apr 2021 09:07:17 GMT',
'content-type': 'application/json',
'content-length': '170',
connection: 'close',
'x-amzn-requestid': '9e30546f-d9a2-4091-bd08-1635b6c8eca0',
'x-amzn-errortype': 'AccessDeniedException',
'x-amz-apigw-id': 'dQE25FsiIE0FsOA='
}
HUMMM 我以为我配置得很好检查我的配置。
根据评论。
问题是由不正确的API基于资源的策略引起的。默认情况下,new API 是 public 并且没有任何策略。但是由于 API 是通过复制现有的创建的,因此现有策略禁止 public 访问。
删除策略并重新部署 API 阶段可以解决问题。