'How to set createProxyMiddleware to be able to apply Set-Cookie?

I have following setting:

const { createProxyMiddleware } = require("http-proxy-middleware");

module.exports = function (app) {
  app.use(
    "/api",
    createProxyMiddleware({
      target: false
        ? "http://localhost:8080"
        : "https://speechifai-poc.herokuapp.com",
      changeOrigin: true,
    })
  );
};

It does not apply Set-Cookie, why?

I have this is response header:

Set-Cookie: sessionIdSp=15vLwiX2+E0nnGMEB8Tw3jgj2l88RUmwzkfJGiqoH3M=; Path=/; Secure; HttpOnly; SameSite=Lax


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source