基于 Edge Functions 的高性能网站反向代理工具
Edge Proxy 是一个轻量级、高性能的网站反向代理工具,利用 Edge Functions 在全球边缘节点部署,提供快速、稳定的代理服务。支持完整的网站代理,自动重写页面中的所有链接和资源。
- Node.js 18.17 或更高版本
- npm 或 yarn 或 pnpm
# 克隆项目
git clone https://github.com/muyuzier-afk/EdgeProxy.git
cd EdgeProxy
# 安装依赖
npm install
# 启动开发服务器
npm run dev访问 http://localhost:3000 查看主页
# 构建项目
npm run build
# 启动生产服务器
npm start# 安装 Vercel CLI
npm i -g vercel
# 登录 Vercel
vercel login
# 部署项目
vercel按照提示操作:
- 选择要部署的项目目录
- 选择或创建 Vercel 账户
- 配置项目设置(通常使用默认设置即可)
- 等待部署完成
部署完成后,你会获得一个 .vercel.app 域名,例如:https://vercel-site-proxy.vercel.app
- 将代码推送到 GitHub
- 访问 Vercel 官网
- 点击 "Add New" -> "Project"
- 导入你的 GitHub 仓库
- Vercel 会自动检测 Next.js 项目
- 点击 "Deploy" 按钮开始部署
- 等待部署完成
点击上面的按钮,按照提示操作即可快速部署。
- 在 Vercel 项目设置中点击 "Domains"
- 添加你的自定义域名
- 按照提示配置 DNS 记录
- 等待 SSL 证书自动签发
访问部署后的网站,在输入框中输入目标网站 URL,点击"代理访问"按钮即可。
# GET 请求
curl "https://your-domain.vercel.app/api/proxy/simple?url=https://api.example.com/data"
# POST 请求
curl -X POST "https://your-domain.vercel.app/api/proxy/simple?url=https://api.example.com/create" \
-H "Content-Type: application/json" \
-d '{"key": "value"}'# 浏览整个网站
https://your-domain.vercel.app/api/proxy/site?url=https://example.com
# 使用路径方式访问
https://your-domain.vercel.app/api/proxy/site/example.comedge-proxy/
├── app/
│ ├── api/
│ │ └── proxy/
│ │ ├── route.ts # 简单代理
│ │ ├── simple/
│ │ │ └── route.ts # 简单代理(单个请求)
│ │ └── site/
│ │ └── route.ts # 完整网站代理
│ ├── doc/
│ │ └── page.tsx # 文档页面
│ ├── about/
│ │ └── page.tsx # 关于页面
│ ├── globals.css
│ ├── layout.tsx
│ └── page.tsx # 主页
├── .eslintrc.json
├── .gitignore
├── next.config.js
├── package.json
├── tsconfig.json
├── vercel.json
└── README.md
MIT License
Copyright (c) 2026 Edge Proxy
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
