Ich hoffe, ich bin hier mit meiner Frage richtig. Ich habe mir ein Tool geschrieben, das u.a. per Javascript auf myip4.softcreatr.com oder myip6.softcreatr.com zugreift. Das hat bis vor kurzem (auf einer Testseite) mit z. Bsp. folgendem Code funktioniert:
fetch('https://myip4.softcreatr.com/')
.then(response => response.json())
.then(response => {
document.getElementById('IP').textContent = response.ip;
})
.catch(err => document.getElementById('IP').textContent = 'Nicht ermittelt')
Aktuell bekomme ich aber folgende Meldung in der Konsole:
Access to fetch at 'https://myip4.softcreatr.com/' from origin 'https://xxx.com' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header has a value 'https://www.softcreatr.com' that is not equal to the supplied origin.
Have the server send the header with a valid value, or, if an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
index.php?my-ip/:525 GET https://myip4.softcreatr.com/ net::ERR_FAILED
Der Aufruf von fetch mit der Option mode: 'no-cors' führt zu einem anderen Fehler:
index.php?my-ip/:525 GET https://myip4.softcreatr.com/ net::ERR_BLOCKED_BY_RESPONSE.NotSameOrigin
Meine Frage SileX ist jetzt, ob du die Einstellungen serverseitig aktuell geändert hast (also Anfragen per Script von außerhalb blockierst, was natürlich zu akzeptieren ist) oder bei mir der Wurm drinnen ist.
lg,
Chris