title: Setting Nodejs cookie after login is not working
body: <p>I am working on a NodeJS Express application. For cookies i am doing this</p>
  <pre><code>var signin = require('./routes/signin');
  var appMgmt = require('./routes/app-mgmt');
  
  app.use('/signin', signin);
  app.use('/api/secure/app', appMgmt);
  
  var cookieParser = require('cookie-parser');
  var app = express();
  app.use(cookieParser());
  var server = require('http').Server(app);
  const io = require(&quot;socket.io&quot;)(server,{
    cors:{
      origin: &quot;*&quot;
    },
    allowEIO3: true
  });
  app.use(cors());
  </code></pre>
  <p>After successful login i am returning this</p>
  <pre><code>      res.cookie('jwt', token, { httpOnly: true, secure: true,maxAge: 86400000 });
        res.status(200).send({userId: data._id, email: body.email, accessToken: token});
  </code></pre>
  <p>and once I get the response back in client, i am doing this</p>
  <pre><code>window.location.replace(&quot;home&quot;);
  </code></pre>
  <p>Problem is i dont see any cookies is getting created:</p>
  <p><a href="https://i.stack.imgur.com/Jmk8K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jmk8K.png" alt="enter image description here" /></a></p>
  <pre><code>app.all('/api/secure/*', function(req, res, next){
    log('Applying API authentication ...');
    var cookies = JSON.stringify(req.cookies);
    log(&quot;Reques content&quot;, cookies);
  </code></pre>
  <p><code>req.cookies</code> returns <code>{}</code></p>