Vue uses axios cross-domain hint 404

the requested address http://www.weather.com.cn/data/cityinfo/101010100.html
is where I wrote it wrong? Prompt GET http://localhost:8080/api/cityinfo/101010100.html 404 (Not Found)

assetsSubDirectory: "static",
    assetsPublicPath: "/",
    proxyTable: {
        "/api": {
           target: "http://www.weather.com.cn/data",
           changeOrigin:true,
           pathRewrite:{
             "^/api":""
           }
        }
    },
methods: {
    weather () {
      this.$http.get("/cityinfo/101010100.html").then(res => {
        console.log(res)
      })
    }
}
Sep.08,2021

There is something wrong with the

code, so there will be no problem if you modify it as follows. But in the production environment, other methods are needed agent
clipboard.png

    proxyTable: {
      '/api': {
        target: "http://www.weather.com.cn/",
        changeOrigin:true,
        pathRewrite:{
          '^/api':'/data'
        }
      }
    },
import axios from 'axios'
export default {
  name: 'App',
  mounted () {
    axios.get('/api/cityinfo/101010100.html').then(res => {
      console.log(res)
    })
  }
}

axios.defaults.baseURL = http://www.weather.com.cn/data/;


I also have this problem. Can you tell me


how to solve it?
xhr.js?b50d:178 POST http://localhost:8080/api/smsCode 404 (Not Found)

Menu