NeWive / UniChatFrontEnd

1 stars 3 forks source link

前端的跨域问题 #14

Open NeWive opened 4 years ago

NeWive commented 4 years ago

我们的项目不可能与服务端在同域下,需要找到一个解决跨域的合理的方法

guokailu commented 4 years ago

在Electron的BrowserWindow模块中配置这样一个参数:// Create the browser window. mainWindow = new BrowserWindow({ webPreferences: { nodeIntegration: true, webSecurity: false } }) 可以解决接受来自不同域下的http 的url请求,但是我不太清楚这个要怎么测试它起不起作用。查到是这样的

NeWive commented 4 years ago

已解决,需要在axios的全局设置中设置 axios.default.withCredential = true 然后加上以上配置可以解决跨域问题以及cookie的携带问题