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.
女神的闺蜜爱上我2017-06-26 10:56:47
if (process.env.NODE_ENV === 'development') {
let api = '/api/'
} else {
let api = ''
}
Try this
滿天的星座2017-06-26 10:56:47
This one on my side is only used locally, and nginx is used as a proxy in the online environment.
滿天的星座2017-06-26 10:56:47
After you build, you are no longer running dev-server.
This cross-domain can be ignored