routing-controllers icon indicating copy to clipboard operation
routing-controllers copied to clipboard

feat: handle entire CORS process (preflight handling)

Open aigoncharov opened this issue 6 years ago • 2 comments

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.

aigoncharov avatar Apr 05 '18 14:04 aigoncharov

Stale issue message

github-actions[bot] avatar Feb 10 '20 00:02 github-actions[bot]

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.

Zenulous avatar Jun 18 '20 12:06 Zenulous