{
  "id": 171717,
  "title": "Cloudflare R2 custom domain returns 404 — a Worker wildcard route was eating it",
  "url": "https://urgent.news/2026/08/05/cloudflare-r2-custom-domain-returns-404-a-worker-wildcard-route-was",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-05T11:04:23.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/lucian_tudor_303e1e12b9e5/cloudflare-r2-custom-domain-returns-404-a-worker-wildcard-route-was-eating-it-1g35"
  },
  "original_language": "en",
  "account": "Cloudflare's R2 custom domain was returning a 404 error due to a Worker wildcard route that was intercepting the requests. Despite everything appearing healthy, the bucket, files, custom domain, and DNS record were all functioning correctly. The issue stemmed from the Worker route taking precedence over the R2 custom domain for the same hostname. A Worker route with a wildcard pattern (.example.com/) was set up earlier and overshadowed the R2 custom domain's functionality for video files. Consequently, when a request was made to media.example.com/clip-01.mp4, the Worker attempted to find a static asset at /clip-01.mp4 but couldn't find it, hence serving the site's default 404 page instead. The R2 dashboard displayed everything working correctly because it wasn't receiving any requests. To resolve the issue, it was necessary to stop using the wildcard route and explicitly define the hostnames that the Worker should serve, such as example.com/* and www.example.com/. Implementing this change allowed the videos to function immediately without any modifications to R2.",
  "summary": "Everything reported healthy. The bucket, the files, the custom domain, the DNS record. And every request to media.example.com returned a 404. It cost me most of a day, so here it is in full. The symptom I had 60 video files in an R2 bucket, served through a custom domain — media.example.com. Every request returned 404. Not a Cloudflare error page, not an XML error from the bucket. A 404. The…",
  "key_points": [
    "Cloudflare R2 custom domain returning 404 error",
    "Worker wildcard route intercepting requests",
    "Resolving by stopping wildcard route and defining hostnames"
  ],
  "editors_take": null,
  "illustration": "https://urgent.news/ill/171717.png",
  "coverage": {
    "outlets": 2,
    "also_reported_by": [
      {
        "outlet": "Dev.to",
        "title": "Cloudflare Worker redirect never runs, because static assets are served first",
        "url": "https://urgent.news/2026/08/05/cloudflare-worker-redirect-never-runs-because-static-assets-are",
        "published": "2026-08-05T11:05:51.000Z"
      }
    ]
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}