← DevLog

3 min read

The panel curl could load and a browser never did

The uptime panel on our homepage sat empty in production while every test with curl answered. The cause was a cache that shares one request between visitors, on a platform that cancels work when its request goes away.

The homepage of gunnie.nl shows a small live panel with the uptime of the sites and servers we look after. One day it sat empty in production. Not an error, not "not connected". Just a card that never filled in.

Every check from the command line worked. curl on the endpoint answered with the figures, most of the time. A browser never got an answer at all.

The setup

The site is a Nuxt app on Cloudflare Workers. The figures come from an API route that asks the monitoring service and reduces the answer to a few numbers. To avoid asking the monitoring service on every page view, the route had a cache rule in the Nuxt config: keep the answer for five minutes.

On the page, two components wanted the same figures: the card in the hero and a line of stats lower down. Nuxt's data fetching noticed the duplicate and cancelled one of the two requests.

What actually happened

Nitro, the server layer under Nuxt, implements that cache with one in-flight promise per cache key. When a request arrives while the answer is being computed, it gets the same promise as the first one and waits for it.

On Workers, the work a request starts belongs to that request. When the browser cancelled one of its two duplicate requests, the fetch to the monitoring service behind it was cancelled too. The shared promise never settled. Nitro never cleared it, because it was waiting for it to settle. Every later request for that route on that Worker instance received the same dead promise and waited forever, until Cloudflare recycled the instance.

That explains the difference between the two clients. curl never cancels anything, so it usually hit an instance where the cache was still healthy. The browser cancelled its duplicate on every page load, and broke the cache on every instance it reached.

The fix

The live-figure routes no longer use the Nuxt cache rule. They use a small helper that stores the answer in the Workers Cache API. Each request does its own work: a hit is read from the cache, and a miss computes and stores. Two misses at the same moment both compute, which costs one extra call to the monitoring service. A request that hangs forever costs a visitor.

On the page, the duplicate requests now wait for each other instead of cancelling, and both panels give up after ten seconds and show their empty state. Even if something hangs again, the card no longer stays blank.

Check yours

  • If you run Nuxt or Nitro on Cloudflare Workers, look for cache rules or cached handlers on routes that fetch from another service. Those are the ones that can hang this way.

  • Test a live panel in a real browser, not only with curl. A browser cancels and deduplicates requests, and curl does not. "curl works and the browser does not" is a symptom worth taking seriously, not a caching quirk to wait out.