我们的安全团队希望我们在AWS上的所有Rest API都有HTTP Strict Transport security (HSTS)头设置,即使我们的api不是从任何网页调用的。
我发现了一些在Lambda响应中设置响应头的用例,但我们的大多数api都链接到SQS或SNS。因此,我不确定如何在AWS API GW中添加此响应头。
有没有人能在这方面指导我。
发布于 2020-12-02 23:08:33
我找到了一个添加严格传输安全(HSTS)响应头的解决方案。我已经通过AWS控制台做到了这一点。
第1步:在方法响应状态码下添加Strict-Transport-Security头。
HSTS第2步:在集成响应下,为 header添加必要的映射值。附件是我试过的样品。必须在单引号(‘)中提供这些值。
第3步:在securityheaders.com网站上验证了这一点。
发布于 2021-12-01 16:09:13
在使用Cloudformation和x-amazon-apigateway-integration
进行设置时,请注意将这些标题值放在双引号之间的单引号中。("'my value here'"
)
例如:
responses:
'200':
description: 200 response for stackoverflow
headers:
Content-Length:
type: string
Timestamp:
type: string
Content-Type:
type: string
Strict-Transport-Security:
type: string
..。
x-amazon-apigateway-integration:
responses:
'200':
statusCode: '200'
responseParameters:
method.response.header.Strict-Transport-Security: "'max-age=31536000'"
https://stackoverflow.com/questions/64858562
复制相似问题