[Vuejs]-Why my Front-End requests are all sended to Back-End project?

0👍

DevServer proxy will proxy requests depend on your proxy config:

// '/'means this rule will match all requests
proxyObj['/']={
  ws: false,
  // target means requests that matched will be sent to http://localhost:8081
  target: 'http://localhost:8081',
  changeOrigin: true,
  pathRewrite: {
      '^/': ''
  }
}

With this config, all your requests will be sent to the backend server, you will receive a response from the server. If you set your config object to null, your requests will be sent to your frontend project: http://localhost:8080, so you can’t receive any response.


See here for more detail about proxy config.

Leave a comment