style: add some notes

This commit is contained in:
vben
2020-10-29 23:01:11 +08:00
parent 7658f4d6e8
commit 2f1fbf8e48
14 changed files with 101 additions and 29 deletions

View File

@@ -3,6 +3,11 @@ type ProxyItem = [string, string];
type ProxyList = ProxyItem[];
const reg = /^https:\/\//;
/**
* Generate proxy
* @param list
*/
export function createProxy(list: ProxyList = []) {
const ret: any = {};
for (const [prefix, target] of list) {
@@ -12,6 +17,7 @@ export function createProxy(list: ProxyList = []) {
target: target,
changeOrigin: true,
rewrite: (path: string) => path.replace(new RegExp(`^${prefix}`), ''),
// https is require secure=false
...(isHttps ? { secure: false } : {}),
};
}