title: Get Cookie from axios response using cors on the server side
body: <p>I run Vue.js 2.5.2 and axios 0.17.1 against a Node.js server using express 4.16.2 and cors 2.8.4.</p>
  
  <p>When I do a login</p>
  
  <pre><code>axios.post('/login', {"username": "a", "password": "b").then((response) =&gt; {
      console.log(response.headers['set-cookie']);
  }
  </code></pre>
  
  <p>I get <code>undefined</code> as output. On other <a href="https://stackoverflow.com/questions/37897523/axios-get-access-to-response-header-fields/37931084">topics</a> they told to set the <code>Access-Control-Expose-Headers: Access-Token, Uid</code>. I did this in my server-config like this:</p>
  
  <pre><code>const express = require('express'),
  cookieParser = require('cookie-parser'),
  cors = require('cors'),
  bodyParser = require('body-parser'),
  const server = express();
  
  server.use(cookieParser());
  server.use(bodyParser.json({limit: '50mb'}));
  server.use(bodyParser.urlencoded({limit: '50mb', extended: true}));
  
  server.use(cors({
    "origin": "*", 
    "credentials": true,
    "exposedHeaders": ["Uid", "Access-Token"]
    // same for "Uid, Access-Token"
    // Adding "set-cookie" to this list did not work.
  }));
  </code></pre>
  
  <p>I can see in the Chrome Developer Toolbar, that <code>Access-Control-Expose-Headers</code>-Option is set in the OPTION-Request and the POST-Request. Also in the POST-Request I can see the set-cookie-header. But the log of <code>response.headers['set-cookie']</code> is still undefined.</p>
  
  <hr>
  
  <p>Edit:</p>
  
  <p>This behavior is in the development-mode:
  Server is running on localhost:3000, client is running on localhost:8080.</p>
  
  <p>When I build the vue.js-client for production mode so that both runs on localhost:3000, it works.</p>
  
  <hr>
  
  <p>Any ideas?</p>
  
  <p>Thank you!</p>