Skip to content
Advertisement

cors error even after allowing all origins *

i have a post request on my at http://localhost:3000 and request resources from http://localhost:5500 even after allowing all origins it gives error. I’m stuck on this for a few hours now please help.

i get this error

JavaScript

this is where i’m setting my header

JavaScript

this is my fetch request

JavaScript

Advertisement

Answer

Try below.

Added a condition to check if the request type is OPTIONS and then return response with status 200.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement