src/setupProxy.js 创建文件 const proxy = require(‘http-proxy-middleware‘ );module.exports = function (app) { app.use(proxy( ‘/api‘ , { target: ‘https://www.easy-mock.com/api/‘ , secure: false , changeOrigin: true , pathRewri
src/setupProxy.js 创建文件
const proxy = require(‘http-proxy-middleware‘); module.exports = function(app) { app.use(proxy(‘/api‘, { target: ‘https://www.easy-mock.com/api/‘ , secure: false, changeOrigin: true, pathRewrite: { "^/api": "/" }, // http://www.easy-mock.com‘ // cookieDomainRewrite: "http://localhost:3000" })); };
如果不行
package.json
添加
"proxy":"http://youAddr.com"
如果还不行
添加
"proxy":{ "/rank/**":{ "target":"http://m.kugou.com", "changeOrigin": true } }