Worker routed only to front page

I have a worker that I’d like to run on my front page - If i attach it to a route of “/” it will work fine with no query parameters, however as soon as you add a query parameter like “/?foo” it will no longer trigger.

Normally the solution to this is “/*” however that will send all traffic to this worker… I don’t want to do that. Is there a way around this?

Have you tried /?* as an additional route?

1 Like

Infix wildcards & query parameters aren’t supported in Workers’ routes so there isn’t really much you can do to have /?foo=bar fire but not /foo.

Route patterns may not contain infix wildcards or query parameters. For example, neither example.com/*.jpg nor example.com/?foo=* are valid route patterns.

1 Like

That is understandable, yet an upgrade in that regard would be much appreciated.