response.cookie() does not send cookie

If you are trying to send cookies in http header in different ports or domain, you will need to allow withCredential: true in your CORS policy in your Express middleware.

origin: 'http://localhost:3000',
methods: ['POST', 'PUT', 'GET', 'OPTIONS', 'HEAD'],
credentials: true
// to enable CORS using credentials

`withCredentials` indicates whether or not cross-site Access-Control requests should be made using credentials.

For multiple arrays of whitelists,

const whitelist = [
const corsOptionsDelegate = function (req: any, callback: any) {
let corsOptions;
if (whitelist.indexOf(req.header('Origin')) !== -1) {
corsOptions = {
origin: true,
methods: ['POST', 'PUT', 'GET', 'OPTIONS', 'HEAD'],
credentials: true
} // reflect (enable) the requested origin in the CORS response
} else {
corsOptions = { origin: false } // disable CORS for this request
callback(null, corsOptions);
// callback expects two parameters: error and options

If it does not work, leave your comment and your solution if you have found out.