Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

před 2 roky
1234567891011121314151617
  1. const httpsRE = /^https:\/\//
  2. export function createProxy(list = []) {
  3. const ret = {}
  4. for (const [prefix, target] of list) {
  5. const isHttps = httpsRE.test(target)
  6. // https://github.com/http-party/node-http-proxy#options
  7. ret[prefix] = {
  8. target: target,
  9. changeOrigin: true,
  10. ws: true,
  11. rewrite: (path) => path.replace(new RegExp(`^${prefix}`), ''),
  12. // https is require secure=false
  13. ...(isHttps ? { secure: false } : {})
  14. }
  15. }
  16. return ret
  17. }