javascript - After vue-cli is released, how to remove the cross-domain proxyTable configuration set in the development environment from the interface address
漂亮男人
漂亮男人 2017-06-26 10:54:47
0
3
820

During development, we used cross-domain because we were in two places, and set it in config/index

proxyTable: {
  '/api': {
    target: 'http://xxx',
    changeOrigin: true,
    pathRewrite: {
      '^/api': '/api'
    }
  }
}

Now after building, when putting the project on the server, all interfaces still exist in /api/, but this is no longer needed. Is there any way to do this? The configuration was removed.

漂亮男人
漂亮男人

reply all(3)
女神的闺蜜爱上我
if (process.env.NODE_ENV === 'development') {
    let api = '/api/'
} else {
    let api = ''
}

Try this

滿天的星座

This one on my side is only used locally, and nginx is used as a proxy in the online environment.

滿天的星座

After you build, you are no longer running dev-server.
This cross-domain can be ignored

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template