【问题标题】:vue-cli3 Could not proxy requestvue-cli3 无法代理请求
【发布时间】:2020-06-23 00:09:32
【问题描述】:

当我运行 npm run start 时,我得到

start": "vue-cli-service serve"

然后我使用http请求,但我得到了

代理错误:无法代理请求 /crm/api/boss/admin/doLogin 来自 本地主机:8080 到 https://qa6boss.qjdchina.com。看 https://nodejs.org/api/errors.html#errors_common_system_errors 为 更多信息 (EPROTO)。

这种行为的原因是什么?

【问题讨论】:

    标签: node.js vue.js webpack


    【解决方案1】:

    尝试添加 pathRewrite 例如:

    '^/api': { 
      target: 'http://localhost:3000', 
      changeOrigin: true, 
      secure: false, 
      pathRewrite: {
        '^/api': '/api'
      }, 
      logLevel: 'debug' 
    },
    

    【讨论】:

      【解决方案2】:
      '^/api': { 
         target: 'http://localhost:3000', 
         changeOrigin: true, enter code here
         secure: false, 
         pathRewrite: {
           '^/api': '/api'
         }, 
         headers: {
           Connection: 'keep-alive'
         }
       },
      
      

      【讨论】:

      • 请提供有关此案的更多详细信息。产生此错误的原因以及有关您的解决方案的更多详细信息。
      猜你喜欢
      • 1970-01-01
      • 2019-07-12
      • 2022-07-05
      • 1970-01-01
      • 2020-08-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-02
      相关资源
      最近更新 更多