http://localhost:8000/user请求成http://localhost:8000/server/user

proxyTable: {

  '/server': {
        target: 'http://localhost:8000/', // 接口的域�?
        // secure: false,  // 如果是https接口,需要配置这个参�?
        changeOrigin: true, // 如果接口跨域,需要进行这个参数配�?
        // pathRewrite: {
        //   '^/api': ''
        // }
    }

    '/user': {
        target: 'http://localhost:8000/user/register', // 接口的域�?
        secure: true,  // 如果是https接口,需要配置这个参�?
        changeOrigin: true, // 如果接口跨域,需要进行这个参数配�?
        // pathRewrite: {
        //   '^/api': ''
        // }
    },
    
    }
阅读 3.8k
2 个回答

localhost:800还是localhost:8000呢?
还有我不太理解为什么把第二个的secure设为true,从代码上来看,你只是链接到了http的接口呀

后端接口地址是 /server/user/register,前端请求的时候url地址写 /server/user/register,

'/server': {
target: 'http://localhost:8000', // 后端服务地址,注意 端口号后面没有 /
changeOrigin: true
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题