-
Notifications
You must be signed in to change notification settings - Fork 4.5k
defaultMethodOptions should be selectively applied to CORS OPTIONS method #8615
Copy link
Copy link
Closed
Labels
@aws-cdk/aws-apigatewayRelated to Amazon API GatewayRelated to Amazon API GatewaybugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortin-progressThis issue is being actively worked on.This issue is being actively worked on.p1
Description
Tl;DR
defaultMethodOptions should exclude options method by default or at least have an option to do that.
Read More
LambdaRestApi has defaultMethodOption, when it is specified, it gets applied to all methods for given api resource. which is awesome but doesn't work when CORS is involved.
Take this simple example,
where I want all the methods to require x-api-key api key so I specify
defaultMethodOption: {
apiKeyRequired: true
}On top of this I also want CORS to be enabled on all api resources so in LambdaRestApi I also specify this
defaultCorsPreflightOptions : {
... cors options
} Because of defaultCorsPreflightOptions an additional method will be created for all my resources to support CORS but because defaultMethodOption applies on all methods, options will also have apiKeyRequired , which it shouldn't.
Environment
- CLI Version : 1.38
- Framework Version: 1.38
- Node.js Version: 12 -->
- OS :
- Language (Version): TypeScript (3.8.3) -->
This is 🐛 Bug Report
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-apigatewayRelated to Amazon API GatewayRelated to Amazon API GatewaybugThis issue is a bug.This issue is a bug.effort/smallSmall work item – less than a day of effortSmall work item – less than a day of effortin-progressThis issue is being actively worked on.This issue is being actively worked on.p1