12月16

for (const [prefix, target] of list)

| |
14:53 软件分析与设计  From: 本站原创
Tags: , , , , ,
阅读(2312) | 评论(0) | 引用(0)
[codes=c#]
VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]


export function createProxy(list: ProxyList = []) {
  const ret: ProxyTargetList = {};
  for (const [prefix, target] of list) {
    const isHttps = httpsRE.test(target);

    // https://github.com/http-party/node-http-proxy#options
    ret[prefix] = {
      target: target,
      changeOrigin: true,
      ws: true,
      rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
      // https is require secure=false
      ...(isHttps ? { secure: false } : {}),
    };
  }
  return ret;
}

[/codes]
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emot
打开HTML
打开UBB
打开表情
隐藏
记住我

昵称 : 

密码(可不填) :  游客无需密码

网址 (可不填) : 

电邮 (可不填) :  [注册]