has been blocked by CORS policy by using axios and fetch in react [duplicate]
问题 This question already has answers here : Axios having CORS issue (2 answers) Closed 8 months ago . I'm trying to do a post request of a server but keep getting a CORS error using axios and fetch in React. the code: fetch('https://api/entries', { mode: 'no-cors', method: 'post', headers: { "Content-Type":"application/octet-stream", 'Access-Control-Allow-Origin': true }, body: JSON.stringify({ "KEY":"VALUE" }) }) .then((response) => { console.log(response) }) .catch(err => console.log(err)) or