Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/content/docs/pages/functions/routing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ This file will include three different properties:

:::note

Wildcards match any number of path segments (slashes). For example, `/users/*` will match everything after the`/users/` path.
Wildcards match any number of path segments (slashes). For example, `/users/*` will match everything after the `/users/` path.

:::

Expand Down Expand Up @@ -188,6 +188,16 @@ Below is another example of a `_routes.json` file. Any route inside the `/build`
}
```

A wildcard can also come before a file extension, and it matches at any depth. Use this when static files and Function routes share a path, such as an API that serves pre-rendered `.json` files beside routes a Function answers. With this `_routes.json`, `/api/users/1.json` and `/api/users/1/posts.json` are served as static assets without invoking the Function, while `/api/users/1` and `/api/search` invoke it:

```json
{
"version": 1,
"include": ["/api/*"],
"exclude": ["/api/*.json"]
}
```

## Fail open / closed

If on the Workers Free plan, you can configure how Pages behaves when your daily free tier allowance of Pages Functions requests is exhausted. If, for example, you are performing authentication checks or other critical functionality in your Pages Functions, you may wish to disable your Pages project when the allowance is exhausted.
Expand Down