Skip to content

llearn/xswitch

This branch is 18 commits behind yize/xswitch:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

93638c7 · Sep 4, 2019
Sep 16, 2018
Sep 17, 2018
Jan 19, 2018
Sep 4, 2019
Jan 12, 2019
Dec 16, 2018
Sep 3, 2019
Sep 19, 2018
Sep 19, 2018
Sep 19, 2018
Sep 20, 2018
Sep 17, 2018
Dec 25, 2018
Sep 24, 2018
Sep 4, 2019
Dec 25, 2018
Dec 16, 2018
Sep 4, 2019
Sep 24, 2018
Sep 24, 2018
Dec 15, 2018
Sep 24, 2018
Sep 24, 2018

Repository files navigation

English

XSwitch

Chrome version Chrome version Build Status Coverage Status license

一个用来做请求链接转发的 Chrome 浏览器插件,因为采用的是浏览器原生 API,安全性和性能能得到保障。

XSwitch-intro

优酷视频介绍

功能

  • 请求地址转发
  • 全局插件启用开关
  • 可禁用浏览器缓存
  • 可在 JSON 中写注释
  • 自动补全
  • 支持 CORS,支持 withCredentials
  • 跨域和缓存禁用键
  • 分组规则

用法

所有的规则,会按照定义的顺序从前往后执行,即使匹配到了规则,也会继续往下匹配。

小提示:把 HTTPS 的链接转发到 http://127.0.0.1 下,浏览器不会出安全提示。如果之前习惯用 localhost 的同学,可以尝试下。

{
  // 转发规则
  "proxy": [
    [
      "//alinw.alicdn.com/platform/daily-test/isDaily.js", // 匹配 URL
      "//alinw.alicdn.com/platform/daily-test/isDaily.json" // 替换成这个 URL
    ],
    // 字符串替换,会全局匹配
    [
      "alinw",
      "g"
    ]
    // 把链接里所有的 .min 替换掉
    // [
    //   ".min",
    //   ""
    // ],
    // 正则
    // [
    //   "(.*)/platform/daily-test/(.*).js$",
    //   "http://127.0.0.1:3000/daily-test/$1.js"
    // ],
    // 直接转换成 inline 模式的 JavaScript
    // [
    //   "https://alinw.alicdn.com/platform/daily-test/isDaily.js",
    //   "data:text/javascript,window.__isDaily = true;"
    // ]
  ],
  // 希望开启 CORS 跨域的链接
  "cors": [
    "cors.a.com",
    "(.*).b.com"
  ]
}

更多说明:https://yuque.com/jiushen/blog/xswitch-readme

License

MIT © yize.shc

About

A Chrome Extension for redirecting/forwarding request urls

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 93.9%
  • TypeScript 5.6%
  • Other 0.5%