-
Notifications
You must be signed in to change notification settings - Fork 192
Feature request: Implement CORS middleware for REST API #4446
Copy link
Copy link
Closed
Labels
event-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler Utilityfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityhelp-wantedWe would really appreciate some support from community for this oneWe would really appreciate some support from community for this one
Metadata
Metadata
Labels
event-handlerThis item relates to the Event Handler UtilityThis item relates to the Event Handler Utilityfeature-requestThis item refers to a feature request for an existing or new utilityThis item refers to a feature request for an existing or new utilityhelp-wantedWe would really appreciate some support from community for this oneWe would really appreciate some support from community for this one
Type
Projects
Status
Shipped
Use case
We should have a middleware that adds CORS headers to responses. The middelware should have sane defaults than can be overridden when initilising the middleware.
Solution/User Experience
The middleware will be applied like any other:
As per the Python implementation the defaults are:
Pre-flight (OPTIONS) calls are typically handled at the API Gateway or Lambda Function URL so no Lambda integration is necessary. However, ALB expects you to handle pre-flight requests so our implementation should still check for the
OPTIONSverb and short-circuit so that we can future proof. This involves returning a WebResponsewith the necessary headers and a HTTP status code of 204.Alternative solutions
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.