Skip to content

Commit 46a837d

Browse files
committed
docs: clarify when middleware is active
1 parent 3171999 commit 46a837d

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

docs/architecture/middleware-stack.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,25 @@ Aside from the actual communication with the upstream STAC API, the majority of
1010
1111
1. **[`CompressionMiddleware`](https://github.com/developmentseed/starlette-cramjam)**
1212

13-
- Handles response compression when [`ENABLE_COMPRESSION`](configuration.md#enable_compression) is enabled
13+
- **Enabled if:** [`ENABLE_COMPRESSION`](configuration.md#enable_compression) is enabled
14+
- Handles response compression
1415
- Reduces response size for better performance
1516

1617
2. **[`RemoveRootPathMiddleware`][stac_auth_proxy.middleware.RemoveRootPathMiddleware]**
1718

19+
- **Enabled if:** [`ROOT_PATH`](configuration.md#root_path) is configured
1820
- Removes the application root path from incoming requests
1921
- Ensures requests are properly routed to upstream API
20-
- Only active if [`ROOT_PATH`](configuration.md#root_path) is configured
2122

2223
3. **[`ProcessLinksMiddleware`][stac_auth_proxy.middleware.ProcessLinksMiddleware]**
2324

25+
- **Enabled if:** [`ROOT_PATH`](configuration.md#root_path) is set or [`UPSTREAM_URL`](configuration.md#upstream_url) path is not `"/"`
2426
- Updates links in JSON responses to handle root path and upstream URL path differences
2527
- Removes upstream URL path from links and adds root path if configured
26-
- Only active if [`ROOT_PATH`](configuration.md#root_path) is set or `upstream_url.path != "/"`
2728

2829
4. **[`EnforceAuthMiddleware`][stac_auth_proxy.middleware.EnforceAuthMiddleware]**
2930

31+
- **Enabled if:** Always active (core authentication middleware)
3032
- Handles authentication and authorization
3133
- Configurable public/private endpoints via [`PUBLIC_ENDPOINTS`](configuration.md#public_endpoints) and [`PRIVATE_ENDPOINTS`](configuration.md#private_endpoints)
3234
- OIDC integration via [`OIDC_DISCOVERY_INTERNAL_URL`](configuration.md#oidc_discovery_internal_url)
@@ -35,47 +37,47 @@ Aside from the actual communication with the upstream STAC API, the majority of
3537

3638
5. **[`AddProcessTimeHeaderMiddleware`][stac_auth_proxy.middleware.AddProcessTimeHeaderMiddleware]**
3739

40+
- **Enabled if:** Always active (monitoring middleware)
3841
- Adds processing time headers to responses
3942
- Useful for monitoring and debugging
4043

4144
6. **[`Cql2BuildFilterMiddleware`][stac_auth_proxy.middleware.Cql2BuildFilterMiddleware]**
4245

46+
- **Enabled if:** [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls) is configured
4347
- Builds CQL2 filters based on request context/state
4448
- Places [CQL2 expression](http://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) in request state
45-
- Only active if [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls) is configured
4649

4750
7. **[`Cql2RewriteLinksFilterMiddleware`][stac_auth_proxy.middleware.Cql2RewriteLinksFilterMiddleware]**
4851

52+
- **Enabled if:** [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls) is configured
4953
- Rewrites filter parameters in response links to remove applied filters
5054
- Ensures links in responses show the original filter state
51-
- Only active if filtering is enabled (see [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls))
5255

5356
8. **[`Cql2ApplyFilterQueryStringMiddleware`][stac_auth_proxy.middleware.Cql2ApplyFilterQueryStringMiddleware]**
5457

58+
- **Enabled if:** [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls) is configured
5559
- Retrieves [CQL2 expression](http://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) from request state
5660
- Augments `GET` requests with CQL2 filter by appending to querystring
57-
- Only active if filtering is enabled (see [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls))
5861

5962
9. **[`Cql2ApplyFilterBodyMiddleware`][stac_auth_proxy.middleware.Cql2ApplyFilterBodyMiddleware]**
6063

64+
- **Enabled if:** [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls) is configured
6165
- Retrieves [CQL2 expression](http://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) from request state
6266
- Augments `POST`/`PUT`/`PATCH` requests with CQL2 filter by modifying body
63-
- Only active if filtering is enabled (see [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls))
6467

6568
10. **[`Cql2ValidateResponseBodyMiddleware`][stac_auth_proxy.middleware.Cql2ValidateResponseBodyMiddleware]**
6669

70+
- **Enabled if:** [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls) is configured
6771
- Retrieves [CQL2 expression](http://developmentseed.org/cql2-rs/latest/python/#cql2.Expr) from request state
6872
- Validates response against CQL2 filter for non-filterable endpoints
69-
- Only active if filtering is enabled (see [`ITEMS_FILTER_CLS`](configuration.md#items_filter_cls) or [`COLLECTIONS_FILTER_CLS`](configuration.md#collections_filter_cls))
7073

7174
11. **[`OpenApiMiddleware`][stac_auth_proxy.middleware.OpenApiMiddleware]**
7275

76+
- **Enabled if:** [`OPENAPI_SPEC_ENDPOINT`](configuration.md#openapi_spec_endpoint) is set
7377
- Modifies OpenAPI specification based on endpoint configuration, adding security requirements
7478
- Configurable via [`OPENAPI_AUTH_SCHEME_NAME`](configuration.md#openapi_auth_scheme_name) and [`OPENAPI_AUTH_SCHEME_OVERRIDE`](configuration.md#openapi_auth_scheme_override)
75-
- Only active if [`OPENAPI_SPEC_ENDPOINT`](configuration.md#openapi_spec_endpoint) is configured
7679

7780
12. **[`AuthenticationExtensionMiddleware`][stac_auth_proxy.middleware.AuthenticationExtensionMiddleware]**
78-
81+
- **Enabled if:** [`ENABLE_AUTHENTICATION_EXTENSION`](configuration.md#enable_authentication_extension) is enabled
7982
- Adds authentication extension information to STAC responses
8083
- Annotates links with authentication requirements based on [`PUBLIC_ENDPOINTS`](configuration.md#public_endpoints) and [`PRIVATE_ENDPOINTS`](configuration.md#private_endpoints)
81-
- Only active if [`ENABLE_AUTHENTICATION_EXTENSION`](configuration.md#enable_authentication_extension) is enabled

0 commit comments

Comments
 (0)