Skip to content

Commit f1035bd

Browse files
fix: Allow setting stac.overrideRootPath to empty string for stac-auth-proxy integration (#307)
1 parent 674c54a commit f1035bd

File tree

3 files changed

+100
-5
lines changed

3 files changed

+100
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121

2222
### Fixed
2323

24+
- Fixed `stac.overrideRootPath` empty string handling for stac-auth-proxy integration - empty string now properly omits `--root-path` argument entirely [#307](https://github.com/developmentseed/eoapi-k8s/pull/307)
2425
- Pin `metrics-server` to `bitnamilegacy` registry due to https://github.com/bitnami/charts/issues/35164 [#309](https://github.com/developmentseed/eoapi-k8s/pull/309)
2526

2627
## [0.7.8] - 2025-09-10

charts/eoapi/templates/services/stac/deployment.yaml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,10 @@ spec:
4040
{{- if (and (.Values.ingress.className) (or (eq .Values.ingress.className "nginx") (eq .Values.ingress.className "traefik"))) }}
4141
- "--proxy-headers"
4242
- "--forwarded-allow-ips=*"
43-
{{- if .Values.stac.overrideRootPath}}
43+
{{- if hasKey .Values.stac "overrideRootPath" }}
44+
{{- if ne .Values.stac.overrideRootPath "" }}
4445
- "--root-path={{ .Values.stac.overrideRootPath }}"
46+
{{- end }}
4547
{{- else }}
4648
- "--root-path={{ .Values.stac.ingress.path }}"
4749
{{- end }}
@@ -55,8 +57,12 @@ spec:
5557
timeoutSeconds: 1
5658
readinessProbe:
5759
httpGet:
58-
{{- if .Values.stac.overrideRootPath}}
60+
{{- if hasKey .Values.stac "overrideRootPath" }}
61+
{{- if ne .Values.stac.overrideRootPath "" }}
5962
path: {{ .Values.stac.overrideRootPath }}/_mgmt/ping
63+
{{- else }}
64+
path: /_mgmt/ping
65+
{{- end }}
6066
{{- else}}
6167
path: /_mgmt/ping
6268
{{- end}}
@@ -66,8 +72,12 @@ spec:
6672
successThreshold: 1
6773
startupProbe:
6874
httpGet:
69-
{{- if .Values.stac.overrideRootPath}}
75+
{{- if hasKey .Values.stac "overrideRootPath" }}
76+
{{- if ne .Values.stac.overrideRootPath "" }}
7077
path: {{ .Values.stac.overrideRootPath }}/_mgmt/ping
78+
{{- else }}
79+
path: /_mgmt/ping
80+
{{- end }}
7181
{{- else}}
7282
path: /_mgmt/ping
7383
{{- end}}

docs/advanced/stac-auth-proxy.md

Lines changed: 86 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# STAC Auth Proxy Integration with EOAPI-K8S
1+
# STAC Auth Proxy Integration with eoAPI-K8S
22

33
## Solution Overview
44

@@ -25,7 +25,7 @@ raster:
2525
2626
## Deployment Guide
2727
28-
### 1. Configure EOAPI-K8S
28+
### 1. Configure eoAPI-K8S
2929
3030
```yaml
3131
# values.yaml for eoapi-k8s
@@ -98,9 +98,93 @@ Expected behavior:
9898
- Check ingress controller logs
9999
- Verify service-specific settings in values.yaml
100100

101+
## Root Path Configuration for Direct Service Access
102+
103+
### Understanding usage of overrideRootPath with stac-auth-proxy
104+
105+
When deploying the eoAPI-K8S with the STAC service behind a stac-auth-proxy, you may want to configure the `stac.overrideRootPath` parameter to control how the FastAPI application handles root path prefixes. This is particularly useful when the auth proxy is responsible for managing the `/stac` path prefix.
106+
107+
When deploying stac-auth-proxy in front of the eoAPI service, you may need to configure the root path behavior to avoid URL conflicts. The `stac.overrideRootPath` parameter allows you to control how the STAC FastAPI application handles root path prefixes.
108+
109+
### Setting overrideRootPath to Empty String
110+
111+
For stac-auth-proxy deployments, you often want to set `stac.overrideRootPath` to an empty string:
112+
113+
```yaml
114+
# values.yaml for eoapi-k8s
115+
stac:
116+
enabled: true
117+
overrideRootPath: "" # Empty string removes --root-path argument
118+
ingress:
119+
enabled: false # Disable external ingress for STAC
120+
```
121+
122+
**Important**: This configuration creates an **intentional inconsistency**:
123+
124+
- **Ingress routes**: Still configured for `/stac` (if ingress was enabled)
125+
- **FastAPI application**: Runs without any root path prefix (no `--root-path` argument)
126+
127+
### Why This Works for stac-auth-proxy
128+
129+
This behavior is specifically designed for stac-auth-proxy scenarios where:
130+
131+
1. **stac-auth-proxy** receives requests via its own ingress and handles the `/stac` path prefix
132+
2. **stac-auth-proxy** filters requests managing the `/stac` prefix and forwards them directly to the STAC service without the path prefix
133+
3. **STAC service** responds from its internal service as if it's running at the root path `/`
134+
135+
### Configuration Examples
136+
137+
#### Standard Deployment (with ingress)
138+
139+
```yaml
140+
stac:
141+
enabled: true
142+
# Default behavior - uses ingress.path as root-path
143+
ingress:
144+
enabled: true
145+
path: "/stac"
146+
```
147+
148+
Result: FastAPI runs with `--root-path=/stac`
149+
150+
#### stac-auth-proxy Deployment
151+
152+
```yaml
153+
stac:
154+
enabled: true
155+
overrideRootPath: "" # Empty string - no --root-path argument
156+
ingress:
157+
enabled: false # Access via auth proxy only
158+
```
159+
160+
Result: FastAPI runs without `--root-path` argument
161+
162+
#### Custom Root Path
163+
164+
```yaml
165+
stac:
166+
enabled: true
167+
overrideRootPath: "/api/v1/stac" # Custom path
168+
```
169+
170+
Result: FastAPI runs with `--root-path=/api/v1/stac`
171+
172+
### Request Flow with stac-auth-proxy
173+
174+
```mermaid
175+
graph LR
176+
A[Client Request: /stac/collections] --> B[stac-auth-proxy]
177+
B -->|Authentication & Authorization| C[Forward: /collections]
178+
C --> D[STAC Service: receives /collections]
179+
D --> E[Response: collections data]
180+
E --> B
181+
B --> A
182+
```
183+
101184
## Additional Notes
102185

103186
- The solution leverages Kubernetes service discovery for internal communication
104187
- No changes required to the STAC service itself
105188
- Zero downtime deployment possible
106189
- Existing deployments without auth proxy remain compatible
190+
- The `overrideRootPath: ""` configuration is specifically for proxy scenarios

0 commit comments

Comments
 (0)