Skip to content

Commit e13a89d

Browse files
committed
docs: update README to include ROOT_PATH configuration and usage tips
1 parent 34ba6b7 commit e13a89d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ The application is configurable via environment variables.
8787
- **Type:** boolean
8888
- **Required:** No, defaults to `true`
8989
- **Example:** `false`, `1`, `True`
90+
- **`ROOT_PATH`**, path prefix for the proxy API
91+
- **Type:** string
92+
- **Required:** No, defaults to `''` (root path)
93+
- **Example:** `/api/v1`
94+
- **Note:** This is independent of the upstream API's path. The proxy will handle removing this prefix from incoming requests and adding it to outgoing links.
9095
- Authentication
9196
- **`OIDC_DISCOVERY_URL`**, OpenID Connect discovery document URL
9297
- **Type:** HTTP(S) URL
@@ -154,6 +159,27 @@ The application is configurable via environment variables.
154159
- **Required:** No, defaults to `{}`
155160
- **Example:** `{"field_name": "properties.organization"}`
156161

162+
### Tips
163+
164+
#### Root Paths
165+
166+
The proxy can be optionally served from a non-root path (e.g., `/api/v1`). Additionally, the proxy can optionally proxy requests to an upstream API served from a non-root path (e.g., `/stac`). To handle this, the proxy will:
167+
168+
- Remove the `ROOT_PATH` from incoming requests before forwarding to the upstream API
169+
- Remove the proxy's prefix from all links in STAC API responses
170+
- Add the `ROOT_PATH` prefix to all links in STAC API responses
171+
- Update the OpenAPI specification to include the `ROOT_PATH` in the servers field
172+
- Handle requests that don't match the `ROOT_PATH` with a 404 response
173+
174+
#### Non-OIDC Workaround
175+
176+
If the upstream server utilizes RS256 JWTs but does not utilize a proper OIDC server, the proxy can be configured to work around this by setting the `OIDC_DISCOVERY_URL` to a statically-hosted OIDC discovery document that points to a valid JWKS endpoint. Additionally, the OpenAPI can be configured to support direct JWT input, via:
177+
178+
```sh
179+
OPENAPI_AUTH_SCHEME_NAME=jwtAuth
180+
OPENAPI_AUTH_SCHEME_OVERRIDE={"type": "http", "scheme": "bearer", "bearerFormat": "JWT", "description": "Paste your raw JWT here. This API uses Bearer token authorization."}
181+
```
182+
157183
### Customization
158184

159185
While the project is designed to work out-of-the-box as an application, it might not address every projects needs. When the need for customization arises, the codebase can instead be treated as a library of components that can be used to augment any [ASGI](https://asgi.readthedocs.io/en/latest/)-compliant webserver (e.g. [Django](https://docs.djangoproject.com/en/3.0/topics/async/), [Falcon](https://falconframework.org/), [FastAPI](https://github.com/tiangolo/fastapi), [Litestar](https://litestar.dev/), [Responder](https://responder.readthedocs.io/en/latest/), [Sanic](https://sanic.dev/), [Starlette](https://www.starlette.io/)). Review [`app.py`](https://github.com/developmentseed/stac-auth-proxy/blob/main/src/stac_auth_proxy/app.py) to get a sense of how we make use of the various components to construct a FastAPI application.

0 commit comments

Comments
 (0)