首页 > 解决方案 > 在 AWS Gateway (REST API) 中添加 HTTP 严格传输安全 (HSTS)

问题描述

我们的安全团队希望 AWS 上的所有 Rest API 都设置 HTTP 严格传输安全 (HSTS) 标头,即使我们的 api 不是从任何网页调用的。

我发现了一些在 Lambda 响应中设置响应标头的用例,但我们的大多数 api 都链接到 SQS 或 SNS。所以我不确定如何在 AWS API GW 中添加这个响应头。

任何人都可以指导我。

标签: amazon-web-servicesaws-api-gatewayhsts

解决方案


I was able to find a solution to add the strict Transport Security (HSTS) response header. I have done this through AWS console.

Step 1: Add the Strict-Transport-Security header under Method Response Status code.

enter image description here

Step 2: Under Integration Response, add the necessary mapping value for HSTS header. Attached is the sample i have tried with. The values has to be provided in single quotes('). enter image description here

Step 3: Verified the same on securityheaders.com website. enter image description here


推荐阅读