Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.
- vue中关于非简单请求跨域问题,跨域配置可如下:
devServer: {
open: false,
host: '127.0.0.1',
port: 8080,
proxy: {
'/commonUrl': {
target: `https://commonUrl`, //这里是重点,原本是http请求,后端写的是https,所以这里改为https
ws: true,
changeOrigin: true,
https: true,
secure: true, // 接受运行在https上,默认不接受
}
}
},