You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/user-guide/configuration.md
+56-6Lines changed: 56 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -323,10 +323,10 @@ These settings configure the CORS behavior when `PROXY_OPTIONS` is `false` (the
323
323
324
324
### `ITEMS_FILTER_PATH`
325
325
326
-
: Regex pattern used to identify request paths that require the application of the items filter
326
+
: Regex patterns used to identify request paths that require the application of the items filter. See [Filter paths and path params](#filter-paths-and-path-params).
327
327
328
-
- **Type:** Regex string
329
-
- **Required:** No, defaults to `^(/collections/([^/]+)/items(/[^/]+)?$|/search$)`
328
+
- **Type:** Regex string, or a JSON array of regex strings
329
+
- **Required:** No, defaults to `["^(?:/collections/(?P<collection_id>[^/]+)/items(?:/(?P<item_id>[^/]+))?|/search)$"]`
@@ -355,8 +355,58 @@ These settings configure the CORS behavior when `PROXY_OPTIONS` is `false` (the
355
355
356
356
### `COLLECTIONS_FILTER_PATH`
357
357
358
-
: Regex pattern used to identify request paths that require the application of the collections filter
358
+
: Regex patterns used to identify request paths that require the application of the collections filter. See [Filter paths and path params](#filter-paths-and-path-params).
359
359
360
-
- **Type:** Regex string
361
-
- **Required:** No, defaults to `^/collections(/[^/]+)?$`
360
+
- **Type:** Regex string, or a JSON array of regex strings
361
+
- **Required:** No, defaults to `["^/collections(?:/(?P<collection_id>[^/]+))?$"]`
362
362
- **Example:** `^.*?/collections(/[^/]+)?$`
363
+
364
+
### Filter paths and path params
365
+
366
+
`ITEMS_FILTER_PATH` and `COLLECTIONS_FILTER_PATH` do two jobs:
367
+
368
+
1.**Scope**: They select the request paths a filter applies to.
369
+
2.**Information**: They declare the request "path parameters" information handed to the filter.
370
+
371
+
**Path params.** Named capture groups in the pattern that matched become `req.path_params`. A pattern declaring no named groups (the default) instead falls back to built-in extraction, which recognizes `/collections/{collection_id}` optionally followed by `items`, `bulk_items`, or `queryables` and an item ID. Patterns using the fallback are named in a log line at startup.
372
+
373
+
**Supporting several patterns.** Covering all of your endpoints may require more than one pattern, especially if using named capture groups which do not support redefinition of the group name. To provide more than one pattern, provide the input as a JSON array.
374
+
375
+
**Authentication.** A path matching either setting always requires authentication, whatever `DEFAULT_PUBLIC` is set to, and is marked accordingly in the OpenAPI spec. A separate `PRIVATE_ENDPOINTS` entry is not needed.
376
+
377
+
**Example: the Aggregation extension.** The [STAC API Aggregation extension](https://github.com/stac-api-extensions/aggregation) adds four endpoints, which `stac-fastapi` registers as:
378
+
379
+
| Path | Methods |
380
+
| --- | --- |
381
+
|`/aggregate`| GET |
382
+
|`/aggregations`| GET |
383
+
|`/collections/{collection_id}/aggregate`| GET |
384
+
|`/collections/{collection_id}/aggregations`| GET |
385
+
386
+
None are covered by the defaults. The two collection-scoped endpoints belong to the collections filter, and each needs its own pattern because both declare `collection_id`:
0 commit comments