V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
levin56
V2EX  ›  问与答

Cloudflare 对 openai 的 workers 反代失效了?

  •  
  •   levin56 · 57 天前 · 2005 次点击
    这是一个创建于 57 天前的主题,其中的信息可能已经有所发展或是发生改变。

    写了个 worker 脚本,昨天开始失效了,返回 unsupported_country_region_territory

    openai 是如何识别到的?

    第 1 条附言  ·  57 天前
    刚刚写了个 vercel 反向代理脚本,处理 sse 感觉要比 cf wokers 复杂,貌似速度上还没有之前用的 cf workers 快
    16 条回复    2024-08-25 02:53:27 +08:00
    hangouts99
        1
    hangouts99  
       57 天前
    不要反代,头部会被识别
    caomingjun
        2
    caomingjun  
       57 天前
    imldy
        3
    imldy  
       57 天前
    可以试试 vercel ,可以指定边缘计算节点所在的区域
    ZeroClover
        4
    ZeroClover  
       57 天前
    https://developers.cloudflare.com/ai-gateway/

    有现成的不用为什么要用反代?
    Silently
        5
    Silently  
       57 天前 via iPhone
    cf 的 ai 网关不好用吗?
    c0okies
        6
    c0okies  
       57 天前
    楼上正解,可以直接用 cloudflare 的 worker ai 或者 ai-gateway
    leesa
        7
    leesa  
       57 天前
    @caomingjun 可以编辑 request headers 从而删除 CF-Worker 吗?
    winterpotato
        8
    winterpotato  
       57 天前
    `cf-connecting-ip` 就会写你的真实 IP 。AI Gateway 多好
    caomingjun
        9
    caomingjun  
       57 天前 via Android
    @leesa 不能,它的目的就是方便你屏蔽甚至举报滥用
    Love4Taylor
        10
    Love4Taylor  
       57 天前
    AI Gateway 能无视 IP 检测?不对吧,为啥我这依旧会被提示
    https://shottr.cc/s/KwS2/SCR-20240712-ubp.png
    daisyfloor
        13
    daisyfloor  
       56 天前
    @winterpotato
    @c0okies

    ai-gateway 可以解决 ip 检测的问题? 比如中国 ip ,调用 ai-gateway 后,出站 ip 就符合 openai 的地区要求了?
    yohole
        14
    yohole  
       56 天前
    亲测,使用 CF 的 ai gateway 会检测来源 ip 地址,我使用 HK 的服务器提示不受支持,换了美国的就正常
    liujunchen
        15
    liujunchen  
       54 天前
    cloudflare 的 ai gateway 也失效了,能检测到国内 ip ,估计 ai gateway 把访问 ip 传到 openai 去了
    leesa
        16
    leesa  
       14 天前
    @winterpotato 可以删`cf-connecting-ip`
    [删除访客 IP 标头
    从发送到原始服务器的请求中删除可能包含访问者 IP 地址的 HTTP 标头。处理以下 HTTP 请求标头:
    cf-connecting-ip
    x-forwarded-for (请参阅下面的注释)
    true-client-ip]
    https://developers.cloudflare.com/rules/transform/managed-transforms/reference/
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   1053 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 23:21 · PVG 07:21 · LAX 16:21 · JFK 19:21
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.