Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource

async function onload(){
let data = {data1: ‘x’, data2: ‘x’};
const response = await fetch(“https://robinschapendonk.ml/info”, {
method: “POST”,
headers: {‘Content-Type’: ‘application/json’},
body: JSON.stringify(data)
});
const responseJson = await response.json();
}

This function is in https://robinschapendonk.ml and it must post some info on https://robinschapendonk.ml/info

Hi @RobinSchapendonk

Is this still giving you trouble? If so:

  • Try adding the missing “Access-Control-Allow-Origin” header to that function.

  • You can also find more info about CORS errors here.

If you need additional help with this, let us know!