我正在尝试使用 Cloudformation 在 AWS APIGateway 的方法执行上设置标头映射。
这是我尝试使用的 Cloudformation JSON 模板片段:
"AlertDetailMock": {
"Type": "AWS::ApiGateway::Method",
"Properties": {
"RestApiId": {
"Ref": "RestApi"
},
"ResourceId": {
"Ref": "AlertDetailResource"
},
"HttpMethod": "OPTIONS",
"AuthorizationType": "NONE",
"Integration": {
"Type": "MOCK",
"RequestTemplates": {
"application/json": "{\"statusCode\": 200}"
}
},
"IntegrationResponses": [
{
"ResponseTemplates": {
"application/json": ""
},
"ResponseParameters": {
"method.response.header.Access-Control-Allow-Origin": "\\'*\\'",
"method.response.header.Access-Control-Allow-Methods": "\\'GET,OPTIONS\\'",
"method.response.header.Access-Control-Allow-Headers": "\\'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token\\'"
},
"StatusCode": 200
}
],
"MethodResponses": [
{
"ResponseModels": {
"application/json": {
"Ref": "AlertDetailsModel"
}
},
"ResponseParameters": {
"method.response.header.Access-Control-Allow-Origin": true,
"method.response.header.Access-Control-Allow-Methods": true, …
Run Code Online (Sandbox Code Playgroud) json amazon-web-services aws-cloudformation devops aws-api-gateway