CF Workers 反代失效

174 天前
 journalist

今天发现 CF Workers 没法正常用了,是不是被 ban 了?

// worker.js
export default {
  async fetch(request) {
    const url = new URL(request.url);
    url.host = 'api.openai.com';
    return fetch(url, { headers: request.headers, method: request.method, body: request.body });
  },
}

Use cloudflare worker to reverse proxy openai, but blocked

1257 次点击
所在节点    OpenAI
11 条回复
journalist
174 天前
看来是 CF 会主动发送请求 IP 的地区 https://github.com/janlay/openai-cloudflare/issues/2
imldy
174 天前
https://github.com/zqgu2016/openai-proxy

试试将这个项目部署在 vercel 上,vercel 会使用 Edge(NetWork/Function)节点运行此项目,可能会使用到在 OpenAI 可用地区的节点,而且节点貌似可以指定( https://vercel.com/docs/edge-network/regions
imldy
174 天前
OceanBreeze
174 天前
我的今天也失效了
riddle4ever
174 天前
aigateway 可以用吗 我用的 worker 奇怪的是并没有失效
lekai63
174 天前
@riddle4ever 不能。我刚试了试
hanqian
174 天前
vercel 上的反代还可以,之前用 edgecast CDN 弄了个反代也能用
mmdsun
173 天前
在 cf 前面再套一层 cdn 呢?
ibruce
173 天前
@mmdsun #8 用哪个 CDN 套呢?
mmdsun
173 天前
@ibruce
我用的 netlify 但效果不是很好,超过 50 秒可能超时。配置参考:
https://docs.netlify.com/routing/redirects/rewrites-proxies/#proxy-to-another-service

建议不用 cf 了 ,直接换 aws 或者 Azure 的云函数去。
ibruce
173 天前
@mmdsun 我用 vercel 一键部署了,简单好用哈哈

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/992583

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX