我已经阅读了相当多的 AWS 文档,但找不到描述 Cloudformation 中 http 请求 header 验证的文档。有人可以帮忙吗?我只需要检查“referer” header 是否存在。
最佳答案
您可以使用 RequestParameters
添加 header 验证您的 AWS::ApiGateway::Method
Cloudformation 资源的属性。文档对于如何使用它并不是非常清楚,但语法应该类似于
RequestParameters:
method.request.header.referer: true
参见this blog post有关使用 Cloudformation 创建 API 资源的工作示例。请注意,该示例验证路径变量而不是 header ,但语法是相同的。
您可能还需要添加 AWS::ApiGateway::RequestValidator
资源到您的 Cloudformation 模板以强制验证,但我怀疑这就是 RequestParameters
映射中的 bool 值的用途,您必须对此进行一些实验。
关于amazon-web-services - 如何在 Cloudformation 中验证 API 网关中的 header ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55686945/