Edge Function path or pattern config to target query parameter

Is it possible to restrict an edge function to any path with a given query parameter?

I’m trying things like

pattern = “^.*?download=.+$”
function = “download”

path = “/?download=
function = “download”

I believe the pattern declaration should work. Is it not? If so, can we have a site name to check?

Hi @hrishikesh , thanks for getting back to me. I tried using the pattern syntax but receive this using netlify deploy

14:14:43 When resolving config file /app/netlify.toml:
Configuration property edge_functions[1] has unknown properties. Valid properties are:
  - path
  - function
  - cache
Invalid syntax
  pattern = "^.*\\?download_file_url=.+$"
  function = "download"
Valid syntax
  path = "/hello"
  function = "hello"

  pattern = "^.*\?download_file_url=.+$"
  function = "download"

@hrishikesh that was fixed by updating the Netlify CLI. But using that pattern does not trigger the edge function based on logs. Site name is knime-playground

Thanks, it indeed looks like it’s not working. I have asked the devs if this is something we intend to support.

The devs checked this and we only match the pattern on the path property of a URL, not the complete URL. The path does not include query params, which is why this doesn’t work.

Thanks for checking. Is there an alternative approach I could do to intercept request with a certain path? I know query param redirects are supported, but I think I tried to redirect to the edge function but that didn’t work.

I’m not sure why you need the query param. Why can’t you simply dedicate a custom path like /download and work with it? What’s the use case here?