proxy error: could not proxy request解决方案

简介: proxy error: could not proxy request解决方案

找到vue.config.js文件,改地址就行:


devServer: {
  proxy: {
    '/api': {
      target: "http://localhost:端口号自己的地址", //这个更换成本地的地址
      changeOrigin: true,
      logLevel: "debug"
    }
  }
}


注:


vue.config.js 是一个可选的配置文件,如果项目的 (和 package.json 同级的) 根目录中存在这个文件,那么它会被 @vue/cli-service 自动加载。你也可以使用 package.json 中的 vue 字段,但是注意这种写法需要你严格遵照 JSON 的格式来写。


在根目录中创建 vue.config.js


5e3a33f9317d4d2fa5dcf8b434852231.png



相关文章
bad boolean config value ‘****‘ for ‘http.sslverify‘
bad boolean config value ‘****‘ for ‘http.sslverify‘
|
5月前
|
Python
proxy配置
proxy配置
Proxy error: Could not proxy request
Proxy error: Could not proxy request
2405 0
Proxy error: Could not proxy request
|
Apache Android开发
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
370 0
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
|
5月前
|
JavaScript 前端开发
什么是Proxy?
什么是Proxy?
151 0
|
11月前
|
JavaScript
Proxy error: Could not proxy request错误解决
Proxy error: Could not proxy request错误解决
478 0
|
11月前
|
自然语言处理 监控 JavaScript
什么是proxy?
什么是proxy?
66 0
|
API
Proxy error: Could not proxy request xxx from localhost:8080 to http://localhost:3000(ECONNREFUSED)
Proxy error: Could not proxy request xxx from localhost:8080 to http://localhost:3000(ECONNREFUSED)
1901 0
Proxy error: Could not proxy request xxx from localhost:8080 to http://localhost:3000(ECONNREFUSED)
ZCMU - 1991: Proxy
ZCMU - 1991: Proxy
86 0
why I get 415 error for my http post Service request creation in JMeter
why I get 415 error for my http post Service request creation in JMeter
128 0
why I get 415 error for my http post Service request creation in JMeter