Specify a route bypassing Workers? Documentation says it’s doable

Route matching behavior documentation:

A route can be specified without being associated with a Worker. This will act to negate any less specific patterns. For example, consider this pair of route patterns, one with a Workers script and one without:

*example.com/images/cat.png -> <no script>
*example.com/images/*       -> worker-script

In this example, all requests destined for example.com and whose paths are prefixed by /images/ would be routed to worker-script, except for /images/cat.png, which would bypass Workers completely. Requests with a path of /images/cat.png?foo=bar would be routed to worker-script, due to the presence of the query string.

Does this feature in fact exist? If so, how would you configure it? I cannot find how to make use of it from the wrangler route configuration documentation nor from the dashboard. :man_shrugging:t2:

Under a website/zone, under Worker Routes (Magic Link: https://dash.cloudflare.com/?to=/:account/:zone/workers), you can click “Add route” and then don’t pick a worker

Oh wow, thanks. I expected to have that option in the main “Workers & Pages” tab (outside Websites).

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.