forked from Minds/front
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathproxy.conf.js
32 lines (30 loc) · 955 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
const engineSecure = Boolean(parseInt(process.env['ENGINE_SECURE']) || 0);
const engineHost = process.env['ENGINE_HOST'] || 'localhost';
const enginePort = process.env['ENGINE_PORT'] || (engineSecure ? 443 : 80);
const PROXY_CONFIG = [
{
context: ['/api', '/fs', '/icon', '/carousel'],
target: {
protocol: engineSecure ? 'https:' : 'http:',
host: engineHost,
port: enginePort,
},
secure: false,
changeOrigin: true,
cookieDomainRewrite: '',
onProxyRes: (proxyRes, req, res) => {
const sc = proxyRes.headers['set-cookie'];
if (Array.isArray(sc)) {
proxyRes.headers['set-cookie'] = sc.map((sc) => {
return sc
.split(';')
.filter((v) => v.trim().toLowerCase() !== 'samesite=none')
.join('; ');
});
}
},
withCredentials: true,
logLevel: process.env['PROXY_LOG_LEVEL'] || 'info',
},
];
module.exports = PROXY_CONFIG;