Could not proxy request /cmsadmin/menus/getMenus from 192.168.43.17:8083

pro 2.0 前端服务器代理,出现该错误。(文件位置在vue.config.里面)

Could not proxy request /cmsadmin/menus/getMenus from 192.168.43.17:8083_第1张图片
原因:target地址上没写http协议。
错误写法:
proxy: {
‘/api’: {
target: ‘localhost:8888/api/’,
changeOrigin: true,
pathRewrite: { ‘^/api’: ‘’ },
},
正确写法:

    port: 8080,

    proxy: {

      [process.env.VUE_APP_API_PREFIX]: {

        target: process.env.VUE_APP_API_HOST,

        autoRewrite: true,

        cookieDomainRewrite: {

          '*': ''

        },

        pathRewrite: {

          ['^' + process.env.VUE_APP_API_PREFIX]: ''

        }

      }

    }

你可能感兴趣的:(Could not proxy request /cmsadmin/menus/getMenus from 192.168.43.17:8083)