Route Pattern Matching

Requests are routed through workers when their URL matches a route pattern assigned to that worker. Route patterns are created either from inside the Cloudflare Workers editor, or by using the Cloudflare API.

Route patterns look like this:


This pattern would match all HTTPS requests destined for a subhost of and whose paths are prefixed by /images/.

While they look similar to Page Rules, route patterns currently differ in the following ways:

  • Route patterns may not contain infix wildcards or query parameters, e.g. neither*.jpg nor* are valid route patterns.

  • When more than one route pattern could match a request URL, the most specific route pattern wins. For example, the pattern* would take precedence over ** when matching a request for

Here is the full set of rules governing route pattern validity:

  • Route patterns must include your zone

    If your zone is, then the simplest possible route pattern you can have is, which would match and, and nothing else.

    As with a URL, there is an implied path of / if you do not specify one.

  • Route patterns may not contain any query parameters

    For example, is not a valid route pattern.

  • Route patterns may optionally begin with http:// or https://

    If you omit a scheme in your route pattern, it will match both http:// and https:// URLs. If you include http:// or https://, it will only match HTTP or HTTPS requests, respectively.

    • matches but not

    • * matches both and

  • Hostnames may optionally begin with *

    If a route pattern hostname begins with *, then it matches the host and all subhosts.

    If a route pattern hostname begins with *., then it matches only all subhosts.

    • * matches and

    • * matches but not

  • Paths may optionally end with *

    If a route pattern path ends with *, then it matches all suffixes of that path.

    •* matches and and

    •* matches but not