typicode / json-server

Get a full fake REST API with zero coding in less than 30 seconds (seriously)
Other
73.05k stars 7.02k forks source link

How can I configure CORS. I see that @tinyhttp/cors is a dependency of JSON-Server #1504

Open kevincam3 opened 9 months ago

kevincam3 commented 9 months ago

How can I configure CORS?

typicode commented 9 months ago

CORS is enabled for all routes by default. There should be not need to configure it.

kevincam3 commented 9 months ago

Unfortunately it's not. image

typicode commented 9 months ago

I'll have a look, thanks for the report

kevincam3 commented 9 months ago

Also just so you have a little background. I'm using Sentry.io and it adds some headers to do browser tracing and it's when it adds these headers that I get the CORS error. Thanks.

acolesnic-stefanini commented 8 months ago

Any news on this issue? I get the same CORS. I am using just React with Vite and "json-server": "^1.0.0-alpha.23"

acolesnic-stefanini commented 8 months ago

The issue is only with alpha releases. i downgraded to version 0.17.4 and indeed CORS is enabled out of the box.

rquispeq commented 7 months ago

The issue is only with alpha releases. i downgraded to version 0.17.4 and indeed CORS is enabled out of the box.

I love you bro, I had the same problem too and it works downgraded the dependency.