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



相关文章
|
1月前
|
API Java
解决HTTP 400 Bad Request错误的方法
解决HTTP 400 Bad Request错误的方法
bad boolean config value ‘****‘ for ‘http.sslverify‘
bad boolean config value ‘****‘ for ‘http.sslverify‘
Proxy error: Could not proxy request
Proxy error: Could not proxy request
2366 0
Proxy error: Could not proxy request
|
9月前
|
JavaScript
Proxy error: Could not proxy request错误解决
Proxy error: Could not proxy request错误解决
361 0
|
Apache Android开发
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
324 0
解决Failed resolution of: Lorg/apache/http/client/methods/HttpEntityEnclosingRequestBase的方案
|
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)
1854 0
Proxy error: Could not proxy request xxx from localhost:8080 to http://localhost:3000(ECONNREFUSED)
|
SQL 关系型数据库 MySQL
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】
经常测试的一个网页,突然报错500。前面也没有发生过,但突然报错,只能先改错了,不然都没法进入页面。为什么会调用到存在bug的语句,而以前没有发生这种情况?这一问题没能想清楚,只能归咎于编译器了。
337 0
【解决思路】HTTP Status 500 Type Exception ReportMessage Request processing failed; 【已解决】
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
122 0
why I get 415 error for my http post Service request creation in JMeter
|
Web App开发 应用服务中间件
tomcat报错:Error parsing HTTP request header
tomcat报错:Error parsing HTTP request header
276 0