How to include a path with query strings in Cloudflare Pages _routes.json

I am currently researching Cloudflare Pages and its Functions feature, and I am unsure how to configure _routes.json.

I want to ensure that when a user visits my website, Pages Functions scripts are only executed if the user is browsing the website’s root directory and includes a query string. All other static resources should be directly returned without going through Pages Functions.

For example:

I have tried using regular expressions in the include section, but it seems to have no effect.

Could someone assist me in resolving this issue? Thank you very much.

You can’t have query strings in the _routes.json

Your file should look like

{
  "version": 1,
  "include": ["/"],
  "exclude": ["/*"]
}

Thank you for your reply, but setting it up this way will result in none of the functions being triggered. It seems that pages functions may not be able to achieve what I want to accomplish.