-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
contributors/good-first-issueGood first issue for a contributorGood first issue for a contributorcontributors/welcomeContributors are welcome to work on thisContributors are welcome to work on thistype/bug
Description
Description:
When using SAM to add CORS support to API GW, it works well for 2xx errors. According to API GW doc, the Lambda function is responsible to return the Access-Control-Allow-Origin
header. However, in the case when API GW returns 4xx (access denied or input validation failure etc.) or 5xx directly without going through the integrated Lambda function, this header is missing. In order to make this work for 4xx and 5xx, I have to add the following in my swagger:
x-amazon-apigateway-gateway-responses:
DEFAULT_4XX:
responseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
DEFAULT_5XX:
responseParameters:
gatewayresponse.header.Access-Control-Allow-Origin: "'*'"
It would be nice if SAM can add these to the swagger if I add cors
in AWS::Serverless::Api
resource.
JoseExposito, francilioaraujo, mkozjak, curtdmiller, suzil and 3 more
Metadata
Metadata
Assignees
Labels
contributors/good-first-issueGood first issue for a contributorGood first issue for a contributorcontributors/welcomeContributors are welcome to work on thisContributors are welcome to work on thistype/bug