I process the response from the server:
xmlhttp.onreadystatechange=function() { answer.innerHTML='<img src="loading.gif">'; // назначаем асинхронный обработчик события if (xmlhttp.readyState==4 && xmlhttp.status==200){ answer.innerHTML=xmlhttp.responseText; // присваиваем содержимое document.getElementById("device").innerHTML= "Cookie: "+xmlhttp.getResponseHeader("Set-Cookie"); } } The server has the following headers:
header('Access-Control-Allow-Origin: *'); session_start(); session_name('RED'); header('Set-Cookie: '.session_name().'='.session_id()); header('Access-Control-Allow-Headers: Set-Cookie'); header('Access-Control-Expose-Headers: Set-Cookie'); The answer is: Cookie: null .
Why does getResponseHeader() not return the Set-Cookie header, explicitly allow Access-Control-Expose-Headers: Set-Cookie and what else?