amazon-web-services - 如何在 Cloudformation 中验证 API 网关中的 header ?

标签 amazon-web-services http-headers aws-cloudformation

我已经阅读了相当多的 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/

相关文章:

python - Boto:从配置中动态获取 Python 代码中的 aws_access_key_id 和 aws_secret_access_key?

javascript - window.location.href 的安全问题

angular - URLSearchParams 不是构造函数

security - 使用HTTP header 的Spring Security

python - 使用 cloudformation 创建时 sns 无法触发 lambda

amazon-web-services - AWS CodeBuild 可以同时构建两个 Docker 镜像吗?

node.js - Firebase 与 AWS/ALB 负载均衡器和 Nginx 后面的多个 Node.js 连接

amazon-web-services - 如何识别 Cloudformation yaml 文件上的错误配置

amazon-web-services - 从 cloudformation 模板调用 lambda 函数

bash - 如何使用 bash 命令将 EMR 步骤添加到 cloudformation