and design pro使用proxy会话丢失问题解决方案

配置proxy时添加以下代码

onProxyRes: function (proxyRes, req, res) {
   let existingCookies = proxyRes.headers['set-cookie'],
   rewrittenCookies = [];

    if (existingCookies !== undefined) {
        if (!Array.isArray(existingCookies)) {
            existingCookies = [existingCookies];
        }

        for (let i = 0; i < existingCookies.length; i++) {
             rewrittenCookies.push(existingCookies[i].replace(/;\s*?(Secure)/i, ''));
        }

        proxyRes.headers['set-cookie'] = rewrittenCookies;
    }
}

你可能感兴趣的:(前端#ant,design,前端)