-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Closed
Labels
@aws-cdk/aws-apigatewayRelated to Amazon API GatewayRelated to Amazon API Gatewayfeature-requestA feature should be added or improved.A feature should be added or improved.management/trackingIssues that track a subject or multiple issuesIssues that track a subject or multiple issues
Description
Requirements
-
resource.addCorsPreflight(options) -
AllowOrigin -
AllowHeaderswith defaults for API Gateway -
AllowMethods -
AllowCredentials -
MaxAge -
ExposeHeaders - Conditional
Varyresponse header - Configure response status code (should default to 204)
- Support proxy and non-proxy resources
- Support multiple origins through velocity templates (like in serverless framework).
- Automatically discover allowed methods by default based on model.
- Recursive (apply to all child resources)
-
LambdaRestApi(apply a CORS policy to all routes) - CORS with custom authorizers (good post) through
AWS::ApiGateway::GatewayResponse
Nice to Have
- Dynamic CORS handler? (through a Lambda proxy and Access-Control-Max-Age=0)
Non-Requirements
- Response headers in simple requests are out of scope.
Resources
- MDN
- SAM implementation
- Serverless Framework implementation
- API Gateway CORS Survival Guide
Notes
Coming from stack overflow
Note that we get a lot of confusion around this since it only configures the Preflight request. Customers expect it to be a magic setting for enabling CORS headers on their Lambda responses. We cant do this because API Gateway does not allow response header mapping for Lambda proxy. Might be better to call this CorsPreflight? At minimum document it clearly.
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-apigatewayRelated to Amazon API GatewayRelated to Amazon API Gatewayfeature-requestA feature should be added or improved.A feature should be added or improved.management/trackingIssues that track a subject or multiple issuesIssues that track a subject or multiple issues