You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Fastify version
4.x
Plugin version
8.4.2
Node.js version
16.X
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
13.5
Description
Preflight request routing is currently broken for index routes in prefixed plugins with scoped cors routes.
I have a setup right now where I instantiate CORS within scoped route plugins - think differing cors rules for /public and /private.
Within each of these plugins, I setup my cors plugin, and have an index route - so within the /public plugin I add a / route.
However, this index route has no preflight support because the options route added by fastify-cors is scoped to /* (previously, this was just *, but that broke some other setups)
A possible workaround would be to register another options handler on /.
Prerequisites
Fastify version
4.x
Plugin version
8.4.2
Node.js version
16.X
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
13.5
Description
Preflight request routing is currently broken for index routes in prefixed plugins with scoped cors routes.
I have a setup right now where I instantiate CORS within scoped route plugins - think differing cors rules for
/public
and/private
.Within each of these plugins, I setup my cors plugin, and have an index route - so within the
/public
plugin I add a/
route.However, this index route has no preflight support because the options route added by fastify-cors is scoped to
/*
(previously, this was just*
, but that broke some other setups)A possible workaround would be to register another options handler on
/
.Steps to Reproduce
Repro: https://github.com/GlenTiki/fastify-cors-bug
Expected Behavior
Preflight requests should not 404 on the index route.
The text was updated successfully, but these errors were encountered: