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: README.md
+26Lines changed: 26 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -87,6 +87,11 @@ The application is configurable via environment variables.
87
87
-**Type:** boolean
88
88
-**Required:** No, defaults to `true`
89
89
-**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.
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
+
157
183
### Customization
158
184
159
185
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