Worker fetch returns 403 in published mode but not local mode

Hi,

I am using CF workers for simple fetching & HTML rewriting.

const res = await fetch("url")

Now for some URLs, the code above works when run in the local mode ( wrangler dev --local) or try it in the playground mode but if I publish the code, or use (wrangler dev), it doesn’t work!

I have no idea why is this happenning. But Here are some additional information that may be helpful:

  • I don’t think it’s SSL related (saw some posts here related to this issue). Even if I don’t use a custom domain, the issue exists.
  • I can curl those urls.
  • Apparently, the other website is on Cloudflare as well.

I think something changes in the published worker fetch requests (maybe Cloudflare edits the request or something) but I did not find any additional details.

Also I get these headers:

cache-control private, max-age=0, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
cf-ray [changed]
connection keep-alive
content-length 16
content-type text/plain; charset=UTF-8
date Tue, 28 Feb 2023 10:24:16 GMT
expires Thu, 01 Jan 1970 00:00:01 GMT
referrer-policy same-origin
server cloudflare
x-frame-options SAMEORIGIN
2:24:16 AM GET / 200

with text content of HTTP response being:
error code: 1106.

Error code 1106 indicated the website operator has chosen to block requests from your IP address. In this case it means the website operator has chosen to block requests from Cloudflare Workers.

1 Like

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