Presence of query string make route match fail



I have a worker that changes the origin for a few routes on our homepage to point to our new marketing site. The routes similar following:*

When I navigate to the root without query string params the worker is activated correctly. However, if a query string such as a utm value is present (i.e. the route match no longer works.

Is this a bug or am I doing something wrong?


I have query string params on my workers and they work fine.
Maybe the worker code:
try adding route, if it doesn’t work can you add part of your code here.*


I get the following error when trying to add query string params.

Route pattern should not have query parameters*

I should also note that query strings work with my wildcard rule under the product directory. It seems like something about matching the root path exactly.

My worker code is the following:

addEventListener('fetch', event => {
  const request = event.request
  const url = new URL(event.request.url)

  if (url.hostname === '') {
    url.hostname = ''
  if (url.hostname === '' || url.hostname === '') {
    url.hostname = ''
  const args = {
    method: request.method,
    headers: request.headers

  if (request.method === 'PUT' || 'POST') {
    args.body = request.body
  return event.respondWith(fetch(new Request(url, args)))


Hi played here:

maybe route:*