Y
Y
Yaroslav2017-02-17 17:11:39
Google Chrome
Yaroslav, 2017-02-17 17:11:39

CORS, express sends all headers, why does the browser get the response but write an error?

Express sends headers and status to the OPTIONS header:

res.header('Access-Control-Allow-Headers', 'Content-Type');
  res.header("Access-Control-Allow-Origin", req.get('origin'));
  res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE');
  res.header('Access-Control-Max-Age', 86400);
  res.status(200).send('OK');

The browser accepts the response but reports an error:
49487c9a5fec4013bf2189b29cc6f515.jpg

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