The port numbers of the front and rear ports of vue are different, and the proxytable agent is invalid across domains.

both front and rear ports are deployed on my computer, only the port number is different. The vuecli, used in the front end uses its own proxytable setting across domains, but when ajax sends the request, it does not change the port number, and the status returns 404

.

dev is configured as follows

 dev: {
    // Paths
    assetsSubDirectory: "static",
    assetsPublicPath: "/",
    proxyTable: {
         // 
      "admin": {
        target: "http://localhost:8004",
    

        changeOrigin: true,
        pathRewrite: {
          "^/admin": ""
        }
      }
    },

    // Various Dev Server settings
    host: "localhost", // can be overwritten by process.env.HOST
    port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, // https://webpack.js.org/configuration/dev-server/-sharpdevserver-watchoptions-

    
    /**
     * Source Maps
     */

    // https://webpack.js.org/configuration/devtool/-sharpdevelopment
    devtool: "cheap-module-eval-source-map",

    // If you have problems debugging vue-files in devtools,
    // set this to false - it *may* help
    // https://vue-loader.vuejs.org/en/options.html-sharpcachebusting
    cacheBusting: true,

    cssSourceMap: true
  },

console status is as follows:

Request URL: http://localhost:8081/admin/register1?0=n&1=a&2=m&3=e&4=%3D&5=%22&6=l&7=o&8=u&9=t&10=o&11=n&12=g&13=%22&14=%26&15=p&16=w&17=d&18=%3D&19=%22&20=1&21=1&22=1&23=1&24=%22
Request Method: GET
Status Code: 404 Not Found
Remote Address: 127.0.0.1:8888
Referrer Policy: no-referrer-when-downgrade

how do you solve this problem?

Mar.22,2021

post the agent

  

Hello, have you solved this problem? I have the same problem.

Menu