'Nodejs dont send cookie with different ports

I have web and api on different port

http://localhost:3000 //web

http://localhost:5000 //api

On stackoverflow i found solution how allow cors everything

var corsOptions = {
    credentials: true,
    origin: function (origin, callback) {
        callback(null, true);
    },
};
app.use(cors(corsOptions));

Its try. I can do request from web with axios. all okey. But in this solution axios dont send cookie. What can i do for make request with cookie ?

axios.defaults.withCredentials = true;
let { data } = await axios.get('http://127.0.0.1:5000/getItem', { withCredentials: true });

cookie exists:

enter image description here



Sources

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

Source: Stack Overflow

Solution Source