Worker's fetch is blocked by cloudflare

I have a couple of cloudflare worker that run daily and call an API endpoint on my website for automation purposes (I need to update some data daily).

Yesterday, that job started to fail with status code “502 (Bad Gateway)”. Looking in my website’s logs, it doesn’t seem like the fetch request even hits my app server at all. So it essentially looks like cloudflare blocks its own worker from hitting the API endpoint behind cloudflare.

Anyone else experiencing this issue?

Tried fetching the root “/” of my site (which works when I access it directly from the browser) and I still get the 502 (Bad Gateway) status code in the worker. When I fetch another website that’s not fronted by cloudflare (e.g. https://putsreq.com/nn7XiK548t8YC5bqclyW) it works as expected, so it only seems to fail when hitting sites fronted by cloudflare, thus why I think it blocks itself

After digging a little more, apparently it was caused by a misconfiguration on my server that I deployed yesterday. I was not seeing any logs on my server because the failure happened before the logger got the chance to log anything, which confused me.

Hello, I’m not getting Error 502: bad gateway, but the troubleshooting steps may help!
Resolution

Contact your hosting provider to troubleshoot these common causes at your origin web server:

  • Ensure the origin server responds to requests for the hostname and domain within the visitor’s URL that generated the 502 or 504 error.
  • Investigate excessive server loads, crashes, or network failures.
  • Identify applications or services that timed out or were blocked.

Hope I can help!

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