1proxy: {
2 "/api": "http://localhost:3000",
3 "/alpha": {
4 target: "http://localhost:8080",
5 pathRewrite: { "^/alpha": "" }
6 },
7 "/bravo": {
8 target: "http://localhost:8080",
9 pathRewrite: { "^/bravo": "" }
10 },
11 "/charlie": {
12 target: "http://localhost:8080",
13 pathRewrite: { "^/charlie": "" }
14 },
15 ...
16 "/zulu": {
17 target: "http://localhost:8080",
18 pathRewrite: { "^/zulu": "" }
19 },
20}
1devServer: {
2 open: true,
3 compress: true,
4 hot: true,
5 inline: true,
6 watchContentBase: true,
7 contentBase: resolve(process.cwd(), 'build'),
8 historyApiFallback: true,
9 before: (app, server, compiler) => {
10 const fileExist = existsSync('./src/setupProxy.js')
11 if (fileExist) {
12 const pathProxy = resolve(process.cwd(), 'src/setupProxy')
13 return require(`${pathProxy}`)(app)
14 }
15 },
16 port: process.env.PORT || 3000,
17 liveReload: false
18 },
1proxy: [{
2 "/api": "http://localhost:3000",
3},{
4 context: ['/alpha', '/bravo', '/charlie', '/zulu'],
5 target: 'http://localhost:8080',
6 rewrite: function (path, req) { return path.replace(/\/(.*?)/g, '') }
7}]