Edge function path glob


I currently have the following in my netlify.toml

function = “regionalise-courses”
path = “/courses/register-for-a-training-course/*”

I would expect this to only apply to pages one level beneath ‘register-for-a-training-course’ so ‘/courses/register-for-a-training-course/course-1’ and ‘/courses/register-for-a-training-course/course-2’ but it’s also applying to the following URLs ‘/courses/register-for-a-training-course/course-1/book’ and ‘/courses/register-for-a-training-course/course-2/book’.

Have I done something wrong here?



Using a * (wildcard) will match anything below the path, regardless of level.

Thanks @jasiqli.

How can I match to just one level below?

I don’t believe there is a way to do that.

I don’t think that is true, see here - Glob Tool | DigitalOcean

So you’ve tried one of these options and succeeded in matching only the single level — not recursing down through all levels?

The link above shows that a single * just matches one level whereas ** will match multiple but Netlify edge function path isn’t behaving like this

Hence my belief there is no way to do so (on Netlify.)

Netlify’s wildcards are not glob patterns, /* means everything after that path, regardless of the level.

Inside your Edge Function, you’d have to check the condition yourself and terminate its execution. If you want to completely prevent the Edge Function from running for the nested paths, you can use the advanced configuration and generate your own RegEx pattern: Create an Edge Functions integration | Netlify Docs

Side note: I’ll also be closing your helpdesk ticket in favour of this thread.

1 Like

Ok thanks @hrishikesh, I will check the path within the function and return it if it doesn’t match instead.

1 Like