The problem of cookie acquisition in create-react-app

the web program generated by create-react-app initiates a request to the api server:

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 execution Settings cookie

response.cookie("token", token, {
      httpOnly: true,
      maxAge: 1000 * 60 * 60 * 24 * 365,
    });
return user;

there is no cookie on the browser


Is

cross-domain?

export const ax = axios.create({
  baseURL: 'http:www.xxx.com/api',
  timeout: 30000,
  withCredentials: true, // cookie
  proxy: {
    host: '127.0.0.1',
    port: 3000,
  },
});
ax.get('/xx');

Menu