Use cloudflare worker to reverse proxy openai, but blocked

HELP

I use cloudflare worker as a reverse proxy of openai, but got following error response (i’m pretty sure that before today, all things worked perfectly):

<h2 class="cf-subheadline"><span data-translate="unable_to_access">You are unable to access</span> api.openai.com</h2>
      </div><!-- /.header -->

      <div class="cf-section cf-highlight">
        <div class="cf-wrapper">
          <div class="cf-screenshot-container cf-screenshot-full">
            
              <span class="cf-no-screenshot error"></span>
            
          </div>
        </div>
      </div><!-- /.captcha-container -->

      <div class="cf-section cf-wrapper">
        <div class="cf-columns two">
          <div class="cf-column">
            <h2 data-translate="blocked_why_headline">Why have I been blocked?</h2>

            <p data-translate="blocked_why_detail">This website is using a security service to protect itself from online attacks. The action you just performed triggered the security solution. There are several actions that could trigger this block including submitting a certain word or phrase, a SQL command or malformed data.</p>

Any help?

我定位到的问题是,openai的API增加了限制中国大陆和香港的规则,这两个地区调用openai的api会返回403,又透传给我worker,worker接到403就反回这个报错。
看着跟自己定义了规则限制自己一样。
台湾、新加坡、日本、美国的IP调用不会返回403。

1 Like

Welcome to the community!

The request was blocked due to configuration by OpenAI, this was their choice and they will be the only ones who could undo it.

We are not able to help you bypass this in this forum, please contact OpenAI with any questions. Thanks!

I have a question that I don’t quite understand, does the default fech of the worker pass the cf by default? Why does openai still recognize my locale even though I’ve proxied the request via fetch, the header address has been rewritten, and the cf has not been passed?

Hi,

You would have to ask that question to OpenAI, we do not have any insight into how they may have configured their rules. Any advice would be inaccurate speculation and it is best to contact OpenAI with questions. Thanks!

I’m asking if the worker’s fetch function forwards the cf by default, this should be a problem with our service, right?

Thanks for the extra clarity!

You cannot overwrite any of the cf- headers, x-real-ip or Host. They will be overwritten back to their intended value. Workers cannot be used to spoof requests in this way. Thanks for the question!

有什么办法吗?

That is exactly how openai block requests. Is there any potential methods to solve it?

Same issue, any workaround to fetch api using cloudflare in China?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.