create-react-app生成的web程序向api服务器发起请求:
export const ax = axios.create({
baseURL: 'http:www.xxx.com/api',
timeout: 30000,
proxy: {
host: '127.0.0.1',
port: 3000,
},
});
ax.get('/xx');
api执行设置cookie
response.cookie('token', token, {
httpOnly: true,
maxAge: 1000 * 60 * 60 * 24 * 365,
});
return user;
浏览器端没有cookie
是不是跨域了?