We’re using a Cloudflare Worker to send requests to a fly.dev url. During periods of higher QPS (50-500), I am getting random intermittent 525s (as reported by response.status in the cf worker) up to ~1% of the time.
Removing force_https from fly.toml and hitting http://x.fly.dev seems to resolve the issue (all requests return 200s), but is not ideal. Perhaps we could handle TLS termination in-app, although I’d prefer not to do that either…
Hmm. Certainly appears to be TLS related, given removing https fixes it, and the 525 code directly relates to that too. Unlike e.g a 500 or 504 etc.
My first thought, given those numbers, would be it could be related to this:
Since I know Workers re-use a single instance, unlike e.g Lambda where is only one instance handling each request. And so it would follow the requests are coming from the same IP. Not quite sure how to avoid that other than handle TLS in-app to avoid any Fly-proxy restriction.
I would have thought Cloudflare would re-use connections too. According to this they do:
Because Cloudflare reuses connections, the TLS handshake time is mostly mitigated, so there’s very little performance advantage to using HTTP rather than HTTPS to origin.
mkdir ./fly-workers
cd ./fly-workers
# install npm (via nvm, if you prefer) if required
# install the wrangler-cli
npm i wrangler
npx wrangler init
# open ./src/index.js, then
@ian1 - Sorry for resurrecting this thread but this sounds exactly like the situation we are seeing as well. We too are making calls to the fly.dev instances from a Cloudflare Worker and seeing 525s randomly.