@@ -164,36 +164,18 @@ export default class ExpressApi extends Construct {
164164 } )
165165 }
166166
167- const api = new HttpApi ( this , 'HttpApi' , {
168- apiName : `Todo-${ getEnvironmentName ( this . node ) } ` ,
169- // corsPreflight: {
170- // allowHeaders: [
171- // // Must explicitly specify Authorization, othwerise maxAge isn't respected and preflight
172- // // will be sent on all requests https://twitter.com/annevk/status/1422959365846351875
173- // // Unfortunately, there appears to be a bug in API Gateway where it doesn't return the
174- // // correct preflight response headers when 'authorization' is defined.
175- // 'authorization',
176- // // '*',
177- // ],
178- // allowMethods: [CorsHttpMethod.ANY],
179- // allowOrigins: Cors.ALL_ORIGINS,
180- // maxAge: Duration.hours(24), // Firefox caps at 24 hours; Chromium caps at 2 hours
181- // },
182- defaultDomainMapping : domainResource
183- ? {
184- domainName : domainResource ,
185- }
186- : undefined ,
187- } )
167+ const api = new HttpApi ( this , 'HttpApi' )
188168 api . addRoutes ( {
189169 path : '/{proxy+}' ,
190170 integration,
191171 authorizer,
192- // Must exclude OPTIONS so that CORS Preflight requests don't get sent through to Lambda,
193- // and instead are fulfilled by API Gateway
194- // methods: [HttpMethod.HEAD, HttpMethod.GET, HttpMethod.POST, HttpMethod.PATCH, HttpMethod.PUT, HttpMethod.DELETE],
195172 methods : [ HttpMethod . ANY ] ,
196173 } )
174+ api . addRoutes ( {
175+ path : '/{proxy+}' ,
176+ integration,
177+ methods : [ HttpMethod . OPTIONS ] ,
178+ } )
197179
198180 // this.enableApiAccessLogs({ api })
199181
0 commit comments