github-proxy是一个部署在 Cloudflare Workers 的 GitHub 代理服务,适合个人或小团队使用,底层路由逻辑基于 hunshcn/gh-proxy重构。如有大需求请参考原项目另外的部署方式。- 修改原因:把一些常用的网站交由自己把控,避免不稳定等情况(还有就是,不想看到广告)。
- 单文件部署,操作简单,无需额外设置。
- 主要用于解决 GitHub 资源加载缓慢、API 速率限制以及前端跨域(CORS)拦截等问题。
- 部署前,可以在
index.js文件的顶部,根据自己的实际需求修改以下常量:
// 代理服务的 URL 路径前缀设置 (默认: '/'),即为 `https://你的域名/`。
// 如果想将其设置特定的子路径,例如 `https://你的域名/proxy/`,请将其修改为 '/proxy/'。
const PREFIX = '/'
// 最大文件代理大小限制 (单位:字节)。0 表示无限制。
// 提示:如果使用此项目并作为公开节点提供服务,建议设置此值以防带宽滥用。
// 例如:限制为 50MB,则修改为 52428800 (50 * 1024 * 1024)。
const MAX_FILE_SIZE = 0 - 登录 Cloudflare 控制台。
- 导航至
Workers 和 Pages,点击创建应用程序->创建 Worker。 - 设定项目名称并点击
部署。 - 点击
编辑代码,清空编辑器内的所有默认代码。 - 将本项目中的
index.js完整代码复制并粘贴到左侧编辑器中。 - 点击右上角
保存并部署。 - 在
域页面可以找到默认生成的workers.dev访问链接。建议在此页面添加自定义域以防默认域名被 DNS 污染,并关闭默认生成的workers.dev访问权限。
运行于 Cloudflare 免费生态:
- 每日请求上限:100,000 次。
- 并发速率限制:1,000 次 / 分钟。
- Single-file deployment; simple to operate, with no additional configuration required.
- It is built to bypass network restrictions, mitigate API rate limits, and resolve Cross-Origin Resource Sharing (CORS) issues when fetching GitHub assets.
- Before deployment, you can modify the following constants at the top of the
index.jsfile according to your specific needs::
// Proxy service URL path prefix setting (Default: '/'), which maps to `https://yourdomain.com/`.
// If you want to set it to a specific subpath, e.g., `https://yourdomain.com/proxy/`, please change it to '/proxy/'.
const PREFIX = '/'
// Maximum file proxy size limit (in bytes). 0 means unlimited.
// Tip: If you are hosting this project as a public node, it is highly recommended to set this value to prevent bandwidth abuse.
// For example: To limit the size to 50MB, modify it to 52428800 (50 * 1024 * 1024).
const MAX_FILE_SIZE = 0 - Log in to the Cloudflare Dashboard.
- Go to
Workers & Pages, clickCreate application, thenCreate Worker. - Name your worker and click
Deploy. - Click
Edit codeand delete all default code in the editor. - Paste the entire contents of
index.jsfrom this repository into the editor. - Click
Save and deploy. - Navigate to
Domainsfind your default.workers.devroute. It is highly recommended to add aCustom Domainon this page for better accessibility, And disable the defaultworkers.devaccess.
Subject to Cloudflare's free tier quotas:
- Daily request limit: 100,000 requests.
- Burst rate limit: 1,000 requests per minute.