Observed Signal · Aug 5, 2026 · Debugging / Troubleshooting · Source: DEV Community · Impact: 2/5 · Sentiment: Neutral

Cloudflare Worker Redirect Skipped for Static Assets

Executive Signal Summary

A developer observed that a Cloudflare Worker fetch handler containing a www→apex redirect never ran because Cloudflare's Workers static assets feature serves requests that match files in the assets directory directly at the edge, bypassing the Worker. As a result, Worker code (including console.log) only executed for asset-miss requests such as 404s. The author recommends using Cloudflare Redirect Rules for host-level redirects because they run earlier in the request sequence and incur no Worker invocations. An alternative is to enable the assets config setting that forces the Worker to run before the asset lookup, but that increases Worker invocations and cost and should be used only when per-request logic is required.

Polaris7 AgentPolaris7 Strategic Assessment
High Confidence

Explains CDN/edge/serverless behavior that can affect request routing, developer debugging, and cost (Worker invocations); relevant to engineers operating Cloudflare Workers but not industry-shifting.

SIGNAL RADAR

Track Cloudflare Signals & Market Shifts in Real-Time

Polaris7 autonomous intelligence agents track regulatory filings, primary sources, executive changes, and deal flow 24/7. Create your free Explorer workspace to monitor these entities.

Start Free in Explorer
Free Explorer tierNo credit card requiredInstant watchlist setup

Key Takeaways & Evidence Grounding

  • Cloudflare Workers static assets serve matching files directly at the edge and do not invoke the Worker fetch handler for those requests.
  • A redirect implemented inside a Worker fetch handler will not run for URLs that resolve to static files, causing the Worker to be bypassed.
  • Cloudflare Redirect Rules run earlier than Workers and are recommended for host-level redirects (e.g., www → apex); they run free on every plan.
  • There is a configuration option to force the Worker to run before the assets lookup, but it increases Worker invocations and may have a different config name over time.

Connected Companies & Entities

7 Entities mapped
Primary Source Grounding & Direct Attribution
Direct Origin Attribution
Primary Reporting: DEV Community•Published: Aug 5, 2026
Original Coverage Title: “Cloudflare Worker redirect never runs, because static assets are served first”

Related Market Signals & Shifts

Recent verified developments and strategic activity across this market segment.

InfrastructureAug 5, 2026

Cloudflare Worker wildcard route caused R2 custom domain 404

A developer's R2 bucket served via a custom domain returned 404s even though the bucket, DNS, and custom domain were healthy. The cause was an existing Cloudflare Worker route with a wildcard pattern that matched the subdomain; the Worker ran first, looked for the asset, and returned the site's 404 page before R2 could respond. The fix was to remove the wildcard route and enumerate the specific hostnames the Worker should serve (for example example.com/* and www.example.com/*). The post also shows a quick diagnostic (check Content-Type via curl) and warns that Cloudflare product dashboards report each product's health independently, which can hide cross-product routing conflicts.

Read assessment
InfrastructureApr 5, 2026

Migrated SaaS from Vercel to Cloudflare Workers

A developer migrated VideoCaptions.AI from Vercel to Cloudflare Workers after hitting Vercel CPU limits during a traffic spike. The migration was done in three reversible phases: moving API routes to a Worker, migrating the full SSR site, and a DNS cutover. Key issues encountered included incompatible Node.js libraries (the AWS SDK) requiring aws4fetch, Workers runtime restrictions (no async I/O or setTimeout at module init), oversized server bundles due to client-only WASM leakage, prerendering/manifest issues with the Cloudflare Vite plugin, and auth key/environment gotchas. The author implemented feature toggles, preview/prod environments via wrangler, and a rollback plan. Post-migration benefits reported: lower monthly costs (~$5.50/month), free WAF/DDoS protection, Turnstile, Web Analytics, Workers Traces, and zero egress fees for R2.

Read assessment
Web/App DevelopmentMay 22, 2026

Make Dynamic MDX Blogs Work on Cloudflare Workers

A developer describes a debugging and deployment pattern for Next.js MDX blogs built with OpenNext and deployed to Cloudflare Workers. The issue arose because runtime reads using node:fs work locally but fail or return empty pages when the app is bundled into a Worker. The recommended fix is to move MDX discovery to build time: parse MDX files before build, generate a metadata TypeScript file and a static import registry that imports each MDX post, and ship those generated modules in the Worker bundle. The post includes example scripts, generated-files examples, test commands (pnpm build:cf and opennextjs-cloudflare preview), and a checklist to avoid runtime filesystem reads and variable MDX imports in production.

Read assessment

Track Real-Time Market Signals & Shifts

Set up custom watchlists to receive automated, evidence-grounded executive digests whenever material signals or shifts occur across your tracked landscape.