-
Notifications
You must be signed in to change notification settings - Fork 0
/
preact.config.js
36 lines (31 loc) · 1.11 KB
/
preact.config.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
import envVars from 'preact-cli-plugin-env-vars';
module.exports = function(config, env, helpers) {
if (config.devServer) {
config.devServer.proxy = [
{
// proxy requests matching a pattern:
path: '/api/**',
// where to proxy to:
target: process.env.BACKEND,
// optionally change Origin: and Host: headers to match target:
// changeOrigin: true,
// changeHost: true,
// optionally mutate request before proxying:
// pathRewrite: function(path, request) {
// // you can modify the outbound proxy request here:
// delete request.headers.referer;
//
// // common: remove first path segment: (/api/**)
// return '/' + path.replace(/^\/[^\/]+\//, '');
// },
// optionally mutate proxy response:
// onProxyRes: function(proxyRes, req, res) {
// // you can modify the response here:
// proxyRes.headers.connection = 'keep-alive';
// proxyRes.headers['cache-control'] = 'no-cache';
// }
}
];
}
envVars(config, env, helpers);
};