vue3.0 proxy method

In a new root folder vue.config.js, root directory is noted that , instead of src path, then the request

 

 

 

module.exports = {
  lintOnSave:false, 
  devServer: {
    overlay:{
      warning:false,
      errors:false
  },
    proxy: { 
      '/api': {
        // target: 'http://172.16.15.27:8081',
        target: 'http://172.16.15.159:8080/', 
        secure: false, // false to http access, true to https access
        changeOrigin: true, // set up cross-domain access, true representatives of the cross-domain
        ws: true,
        pathRewrite: {// Path rewrite rules
          '^ / Api': '' // in / proxy / rewrites beginning with '
        }
      }
    }
  }
}

  

Guess you like

Origin www.cnblogs.com/zhupanpan/p/12165055.html