o3-mini suggested me to add cookiePathRewrite
to setupProxy.js
and it solved my problem:
const {createProxyMiddleware} = require('http-proxy-middleware');
module.exports = function (app) {
app.use(
'/api',
createProxyMiddleware({
target: 'http://localhost:5000',
changeOrigin: true,
cookiePathRewrite: {
'/refresh': '/api/refresh',
},
})
);
};