Skip to content

Elixinyi777/Roboflow-proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Roboflow 中转代理 - 部署指南

原理

你的后端 → Vercel中转(美国IP) → Roboflow API 绕过 Cloudflare 对中国 IP 的封锁,免费、永久有效。


第一步:部署到 Vercel(5 分钟)

方式 A:最快 - 用 Vercel CLI(推荐)

  1. 安装 Vercel CLI:

    npm install -g vercel
  2. 进入 roboflow-proxy 文件夹:

    cd roboflow-proxy
  3. 部署:

    vercel --yes
  4. 首次会要求登录(用 GitHub 账号即可),然后自动部署。 部署完成后会显示类似:

    https://roboflow-proxy-xxxx.vercel.app
    

    记下这个 URL。

  5. 部署到生产环境(获得稳定链接):

    vercel --prod

方式 B:网页操作 - 通过 GitHub

  1. 把 roboflow-proxy 文件夹推到一个 GitHub 仓库
  2. 打开 https://vercel.com ,用 GitHub 登录
  3. 点 "New Project" → 选那个仓库 → Deploy
  4. 部署完成后拿到 URL

第二步:验证代理可用

部署成功后,在你电脑 PowerShell 里测试(把 xxx 换成你的 Vercel 域名):

curl.exe "https://roboflow-proxy-xxx.vercel.app/api/detect/litter-detection-pbz2j/6?api_key=rf_1m1qOpiQOXevcsuhLHhi7FJm1Uv1&image=https://media.roboflow.com/dog.jpeg"

如果返回 JSON 检测结果(而不是 Cloudflare 拦截页),说明代理正常工作。

如果返回的是 Roboflow 的 JSON 错误(比如 invalid api key),那是 key 或模型的问题,跟代理无关。


第三步:修改后端代码(只改 1 行)

在你的后端项目里找到调用 Roboflow 的代码。 通常在 backend/app/ 目录下某个文件里,搜索 detect.roboflow.com, 把:

https://detect.roboflow.com/

改成:

https://roboflow-proxy-xxx.vercel.app/api/detect/

只是换了域名前缀,后面的模型路径、api_key 参数完全不变。

然后重启后端:

systemctl restart cityeye-backend

完成!

手机采集页点"开始采集",后端的 Roboflow 请求会走 Vercel 中转,不再被 Cloudflare 拦截。

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors