E
E
evgeniy20242022-03-25 15:24:38
Node.js
evgeniy2024, 2022-03-25 15:24:38

How to solve the problem with CORS?

Hello everyone, there is a site written on the MERN stack, I posted it on the heroku service.
An error appears related to the cors policy, well, I connected the cors module, configured it

const corsOptions = {
  "origin": "*",
  "methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
  "preflightContinue": false,
  "optionsSuccessStatus": 204,
  "allowedHeaders": ["Content-Type"]
}
app.use(cors(corsOptions))

the error still does not disappear, well, in general, by trial and error, I noticed that due to the bcrypt module this problem occurs with the cors policy, as soon as I do not connect it, everything works as it should.
I thought that maybe because of the versions of node and bcrypt does not work, but according to the versions everything is fine
In general, it doesn’t work any more

I would be very grateful for the help

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question