forked from onecx-apps/ping-angular-app-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
proxy.conf.js
36 lines (34 loc) · 837 Bytes
/
proxy.conf.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
const bypassFn = function (req, res, proxyOptions) {
if (req.method === 'OPTIONS') {
res.setHeader('Allow', 'GET, POST, HEAD, PUT, DELETE, OPTIONS');
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', '*');
res.setHeader('Access-Control-Allow-Headers', '*');
return res.send('');
} else {
return null;
}
};
const PROXY_CONFIG = {
'/portal-api': {
target: 'http://tkit-portal-server/',
secure: false,
pathRewrite: {
'^/portal-api': '',
},
changeOrigin: true,
logLevel: 'debug',
bypass: bypassFn,
},
'/api': {
target: 'http://your-bff-server/',
secure: false,
pathRewrite: {
'^/api': '',
},
changeOrigin: true,
logLevel: 'debug',
bypass: bypassFn,
},
};
module.exports = PROXY_CONFIG;