Ajax: CROS-DOMAIN request not setting cookies with Safari IOS using PHP
<p>I'm trying to set a cookie using PHP CROS-DOMAIN, meaning my JS is hosted in other domain, the JS call to PHP page which trying to set a cookie.
It works in all browsers except to Safari in mobile (iPhone 6) 
The weird thing is that I can get to user cookies but not to set (sometimes it sets an empty cookie, with 0 bytes)  </p>

<p>here is my code in the php file:</p>

<pre><code>header('Access-Control-Allow-Origin: '.$origin);        
header('Access-Control-Allow-Methods: POST, OPTIONS, GET, PUT');
header('Access-Control-Allow-Credentials: true');
header('Access-Control-Allow-Headers: X-Requested-With');
header('Access-Control-Max-Age: 1728000');
setcookie("display_session_id", "1234", time() + (60 * 43800), "/", '.mydomain.com', false);
</code></pre>

<p>I tried to put * instead the $origin but it wasn't work.
Also I tried to put those declarations in my .htaccess but it wasn't work.
Server: Apache
PHP version: 5.4.45</p>

<p><a href="http://i.stack.imgur.com/HFPAC.png" rel="nofollow">here are the headers from Safari</a></p>