routing-controllers
routing-controllers copied to clipboard
feat: handle entire CORS process (preflight handling)
Routing-controllers allows to set config for 'cors' module, but it doesn't enabling handling of pre-flight requests https://github.com/expressjs/cors#enabling-cors-pre-flight I suggest to expose another option to createExpressServer (like 'handleCorsPreflight') to enable it.
Stale issue message
I agree that it would be nice to have an intuitive solution. Luckily, it is possible to handle preflight as follows within the createExpressServer
options (this solution works for Express):
cors: { preflightContinue: false }
This will enable CORS and handle preflight without passing preflight requests onto further middleware, ensuring that both 'types' of CORS requests can succeed.