[Vuejs]-Setup proxy dev server for ASP.NET Core MVC application and Vue clients

0👍

If your backend works on let’s say localhost:80, and your vue app works on localhost:8080, you can proxy specific requests to backend prefixing routes so that dev server understands what requests to proxy

// vue.config.js
module.exports = {  
  devServer: {
    port: 8080,
    proxy: {
      "/api": {
        target: "http://localhost:80"
      }
    }
  }
}

Now requests to /api/first-vue and /api/second-vue will be proxied to 80th port

Leave a comment