Like everyone else who attempts it, I am having trouble getting CORS to work. My code is as follows:
fetch(url, {
mode: 'cors',
cache: 'no-cache',
method: 'post',
credentials: 'include',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify(body),
});
Regardless of the URL, I do not get the origin
header of the request showing in Chrome’s Network tab.
And (“correctly”) the request fails with as CORS Error
.
The method
header isn’t there either, but I don’t know if that is part of the problem.
(Enragingly, this seems to work on Safari.)