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
/node_modules/find-my-way/index.js:292
throw new Error(`Method '${method}' already declared for route '${path}' with constraints '${JSON.stringify(constraints)}'`)
^
Error: Method 'OPTIONS' already declared for route '/*' with constraints '{}'
at Router._on (/node_modules/find-my-way/index.js:292:13)
at Router.on (/node_modules/find-my-way/index.js:136:10)
at Object.addNewRoute (/node_modules/fastify/lib/route.js:262:16)
at Object.route (/node_modules/fastify/lib/route.js:194:19)
at Object._route [as route] (/node_modules/fastify/fastify.js:268:27)
at fastifyHttpProxy (/node_modules/@fastify/http-proxy/index.js:291:11)
at Plugin.exec (/node_modules/avvio/plugin.js:130:19)
at Boot.loadPlugin (/node_modules/avvio/plugin.js:272:10)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
@amitkTechno I didn't. You can remove /* route (if logic of your app allows to do so) and it will work, alternatively you could set the cors headers yourself
Prerequisites
Fastify version
4.5.3
Plugin version
9.2.1
Node.js version
16.15.1
Operating system
macOS
Operating system version (i.e. 20.04, 11.3, 10)
13.4
Description
I need to allow CORS for my Fastify application. To achieve this I'm using
@fastify/cors
package with following settings:if I register the http-proxy route for something like this:
I will get an error:
Probably because of this part of the lib:
Steps to Reproduce
Register
fastify/cors
withfastify/fastify-http-proxy
for all routesExpected Behavior
There is a way to enable cors on all routes for http-proxy plugin
PS:
I tried something like:
but it didn't do the trick for me
The text was updated successfully, but these errors were encountered: