Proxy error: Could not proxy request /captchaImage from localhost to http://192.168.x.xx:8080. See h

Proxy error: Could not proxy request /captchaImage from localhost to http://192.168.x.xx:8080.
See https://nodejs.org/api/errors.html#errors_common_system_errors for more information (ETIMEDOUT).
Proxy error: Could not proxy request /captchaImage from localhost to http://192.168.x.xx:8080. See h_第1张图片
因为服务器不是在我本地。需要对服务器请求地址进行配置。

在vue.config.js中配置服务器请求地址

proxy: {
      // detail: https://cli.vuejs.org/config/#devserver-proxy
      [process.env.VUE_APP_BASE_API]: {
        target: `服务器地址`,
        changeOrigin: true,
        pathRewrite: {
          ['^' + process.env.VUE_APP_BASE_API]: ''
        }
      }
    },

你可能感兴趣的:(vue,前端,vue,跨域)