This feature is in
Unlike regular functions, edge functions aren’t automatically assigned a URL route for you to use as a function endpoint. Instead, you create declarations to configure your edge functions to run on specific URL patterns.
Each edge function declaration associates one site path pattern with one function to execute on requests that match the path. A single request can execute a chain of edge functions from a series of declarations. A single edge function can be associated with multiple paths across various declarations.
# Add a declaration
Declare your edge functions in
netlify.toml using the
edge_functions property. This maps glob-style routes to an array of functions that will run — in order — for any requests that match the routes.
[[edge_functions]] path = "/admin" function = "auth" [[edge_functions]] path = "/admin" function = "injector" [[edge_functions]] path = "/blog/*" function = "auth" [[edge_functions]] path = "/blog/*" function = "rewriter" [[edge_functions]] path = "/*" function = "common"
This example shows how both paths and functions can be configured across multiple declarations.
- A request for
/adminwould invoke the
authfunction first, then
injector, and finally
authfunction runs for the
/adminpath and any child paths of
# Declaration processing order
Keep the following considerations in mind when working with Edge Functions.
- Your declarations in
netlify.tomlare processed before framework-generated declarations.
- Routes are evaluated against
netlify.tomldeclarations in order from top to bottom.
- Edge functions declared for a path run before redirects declared for that path.
- Note that any edge function declared for the target path of a rewrite will not execute for rewritten requests.
Did you find this doc useful?
Your feedback helps us improve our docs.