使用 API Gateway 导入 API 对资源启用 CORS
Posted cloudrivers
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了使用 API Gateway 导入 API 对资源启用 CORS相关的知识,希望对你有一定的参考价值。
/users options: summary: CORS support description: | Enable CORS by returning correct headers consumes: - application/json produces: - application/json tags: - CORS x-amazon-apigateway-integration: type: mock requestTemplates: application/json: | "statusCode" : 200 responses: "default": statusCode: "200" responseParameters: method.response.header.Access-Control-Allow-Headers : "‘Content-Type,X-Amz-Date,Authorization,X-Api-Key‘" method.response.header.Access-Control-Allow-Methods : "‘*‘" method.response.header.Access-Control-Allow-Origin : "‘*‘" responseTemplates: application/json: | responses: 200: description: Default response for CORS method headers: Access-Control-Allow-Headers: type: "string" Access-Control-Allow-Methods: type: "string" Access-Control-Allow-Origin: type: "string"
responses:
200:
description: Default response for CORS method
headers:
Access-Control-Allow-Headers:
type: "string"
Access-Control-Allow-Methods:
type: "string"
Access-Control-Allow-Origin:
type: "string"
以上是关于使用 API Gateway 导入 API 对资源启用 CORS的主要内容,如果未能解决你的问题,请参考以下文章
需要配置serverless资源输出获取api gateway api id
使用 Cloudformation 的 AWS Api Gateway 代理资源?
使用 API Key 或 Authorizer 授权 AWS API Gateway
AWS API Gateway CORS 对 OPTIONS 正常,对 POST 失败
如果在 Terraform 模块中创建了 aws_api_gateway_integration,如何在 aws_api_gateway_deployment 资源上填充depends_on?