Closed robertistok closed 7 years ago
You have a typo in Acces-Control-Allow-Headers
, it should be Access-
. That might be why Content-Type is not an accepted header.
Ohh, I can't believe it, I'm a little bit ashamed.. Thank you very much, I must be more careful..
Happens to all of us :)
Hello everybody!
I ran into this problem, while coding a react-redux app with nodejs, expressjs and mongodb.
Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight response.
I google a lot, and also set my headers in the server, the code is pasted below: https://jsbin.com/gixemivici/edit?js
I observed this error, while sending a post request to the server via axios, this is the code for that:
const request = axios({ method: 'post', url:
${ROOT_URL}/signin, data: formValues, headers: [] });
I managed to workaround the problem using the "Allow-Control-Allow-Origin:*" google chrome extension, but I hope there is a nicer way :).
Thank you for your time reading my issue!