API Gateway統合レスポンスのヘッダーのマッピングで固定値を設定
2020-11-02
CloudFormation(.yaml)で、API Gatewayの統合レスポンスのヘッダーのマッピングで固定値を指定したい場合は、次のように書くとよい。
SomeMethod:
Type: AWS::ApiGateway::Method
Properties:
HttpMethod: POST
...
Integration:
Type: AWS
IntegrationHttpMethod: POST
...
IntegrationResponses:
- StatusCode: 200
SelectionPattern: "status:200"
ResponseParameters:
# OK
method.response.header.X-STATIC-HEADER: "'1'"
# NG
method.response.header.X-STATIC-HEADER: 1
# NG
method.response.header.X-STATIC-HEADER: "1"