title: $http response Set-Cookie not accessible
body: <p>I'm currently writing an angularjs frontend to my backend, and I'm running into a somewhat common issue:</p>
  
  <p>Server sends a cookie back in a response, but is completely ignored by angular.js (can't even print out the 'Set-Cookie' value).</p>
  
  <p>I've tried reading</p>
  
  <p><a href="https://stackoverflow.com/questions/15026016/set-cookie-in-http-header-is-ignored-with-angularjs">Set-Cookie in HTTP header is ignored with AngularJS</a></p>
  
  <p><a href="https://stackoverflow.com/questions/19383311/angularjs-http-does-not-seem-to-understand-set-cookie-in-the-response">Angularjs $http does not seem to understand &quot;Set-Cookie&quot; in the response</a></p>
  
  <p>but unfortunately I've tried all the solutions there and just doesn't seem to work.</p>
  
  <p>Request sent</p>
  
  <p><img src="https://i.stack.imgur.com/GgV0i.png" alt="(as captured by Chrome Developer Tools)"></p>
  
  <p>Response received</p>
  
  <p><img src="https://i.stack.imgur.com/fOI1b.png" alt="(as captured by Chrome Developer Tools)"></p>
  
  <p>I'm using angular.js (v1.2.10), and this is what I used to make the request</p>
  
  <pre><code>$http.post('/services/api/emailLogin',
             sanitizeCredentials(credentials), 
             {
                withCredentials: true
             }).success(function(data, status, header) {
                  console.log(header('Server'));
                  console.log(header('Set-Cookie'));
                  console.log(header('Access-Control-Allow-Headers'));
                  console.log(header('Access-Control-Allow-Methods'));
                  console.log(header);
              }).then(
                  function(response) {
                      console.log(response);
                      return response.data;
                  });
  </code></pre>
  
  <p><code>withCredentials=true</code> is set on the client side before making the request. </p>
  
  <p><code>Access-Control-Allow-Credentials=true</code> is set on the server side before returning the response.</p>
  
  <p>You can clearly see <code>Set-Cookie</code> is in the response headers from Chrome Developer Tools, but printout is just</p>
  
  <p><img src="https://i.stack.imgur.com/bMpcV.png" alt="(code printout)"></p>
  
  <p>Only <code>Set-Cookie</code> in the response header is not being printed out.  I'm wondering why does this occur?  Is there a way for me to make sure <code>withCredentials=true</code> is indeed set (I didn't see it in the request header)?</p>
  
  <p>Any help is appreciated!</p>