Invalid mpvue+iview weapp proxyTable proxy configuration

mpvue+iview weapp developer Mini Program, configure proxyTable
proxyTable: {

in the index under the config folder
  "/api": {
    target: "https://xxxxx/api",
    changeOrigin: true,
    secure: false,
    pathRewrite: {
      "^/api": ""
    }
  }
},

where the request is encapsulated
fly.config.baseURL ="/ api"
but the request will report an error

Jul.15,2021

solve

  1. modify fly baseURL
fly.config.baseURL = 'http://localhost:xxxx'; // => dev
  1. modify the webpack configuration, that is, the proxyTable you described (this is actually the property name that appears after mpvue overrides the webpack configuration file)
pathRewrite: {
  'http://localhost:xxxx': 'http://yourserver.com' // => api
}

reason

  • the content of the error is illegal url.
  • your request address has only a path and no domain name, which must be illegal. That's why webpack didn't add a domain name when it was packaged and rewritten
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b409fc-348db.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b409fc-348db.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?