Skip to content
BloggerSpot
Cloudflareguide

What Does /* Mean, and Why Do www and Non-www Need Separate Routes?

By The BloggerSpot Author
Cloudflare routing rule showing a wildcard pattern

Buried in Cloudflare’s routing settings, I found a rule that read:

www.yoursite.com/*

That little /* at the end confused me more than almost any single symbol in this entire project.

What /* Means

It’s a wildcard. In plain terms: “this rule applies to this exact page, and to every page that comes after it.”

  • www.yoursite.com (no wildcard) matches only the exact homepage
  • www.yoursite.com/* matches the homepage and every other page — /about, /contact, everything

Without the wildcard, a rule intended to cover your whole site would silently only apply to one page.

The Bigger Confusion: www and Non-www Are Not “The Same Site” to Cloudflare

As a human, yoursite.com and www.yoursite.com feel like the same website. Cloudflare’s routing layer does not see it that way. They’re two entirely separate hostnames, and each needs its own explicit instruction for where traffic should go.

Two Overlapping Systems That Do the Same Job

  • Custom Domains — attached directly inside a Worker’s or Pages project’s own settings
  • Workers Routes — a separate section where you can manually map URL patterns to a Worker

Having both mechanisms pointing at the same destination for the same hostname is a common source of Error 522 — not because either method is wrong on its own, but because two systems both claiming the same traffic creates a conflict.

How to Set This Up Correctly

  1. Decide which version of your domain is canonical — most sites pick non-www, though either is valid
  2. Set up your primary routing (one mechanism, not both) with /* if you want it to cover every page
  3. Set up a redirect rule (Rules → Redirect Rules) to send the non-canonical version to the canonical one
  4. Test both versions after making changes

The Takeaway

To a human, www and non-www are the same website. To Cloudflare’s routing system, they’re two strangers who each need their own formal introduction, and /* is the difference between a rule covering your whole site or just its front door.