title: HTTP Cookies and Ajax requests over HTTPS
body: <p>I know this has been asked before in various forms, but I can't seem to get around the problem. 
  I have tried using both jQuery and the native JS API to make the Ajax requests.</p>
  
  <p>My situation is the following (see attached diagram):</p>
  
  <ol>
  <li>Browser makes HTTP request</li>
  <li>Server responds and sets persistent Cookie</li>
  <li>Browser makes HTTP Ajax request, Cookie is there alright</li>
  <li>Server responds as expected, updates Cookie</li>
  <li>Browser makes HTTPS Ajax request, Cookie is not there anymore (?!)</li>
  <li>Server gives "default" response, since there is no Cookie (unintended behaviour)</li>
  </ol>
  
  <p>Before anybody starts a lecture on cross-domain requests let me state a couple of things:</p>
  
  <ul>
  <li>I know that this is a cross-domain request (different protocol), and that's why the Server sets the <code>Access-Control-Allow-Origin</code> header in the response (and I am using Chrome and Firefox, both of which support <a href="http://en.wikipedia.org/wiki/Cross-origin_resource_sharing" rel="noreferrer">CORS</a>)</li>
  <li>What I also know, though, is that the HTTP cookie ought to be manageable over HTTPS (see <a href="https://stackoverflow.com/questions/2163828/reading-cookies-via-https-that-were-set-using-http">here</a>) since the host is the same</li>
  <li>(EDIT) The cookie is properly set for the general domain (e.g. .domain.ext) and neither the HttpOnly nor the Secure flags are set</li>
  </ul>
  
  <p>So, why, why, why doesn't the browser pass on the cookie when making the HTTPS Ajax call? Any ideas? I am about to lose my mind...</p>
  
  <pre><code>     +-----------+ HTTP Request     +-----------+
       |Browser    |+----------------&gt;|Server     |
       +-----------+                  +-----------+
  
                     HTTP Response
                    &lt;----------------+
                     Set-cookie
  
                     Ajax HTTP Req.
                    +----------------&gt;
                     Cookie (OK)
  
                     HTTP Response
                    &lt;----------------+
                     Set-cookie (OK)
  
                     Ajax HTTPS Req.
                    +----------------&gt;
                     No Cookie (!!!)
  </code></pre>