Skip to content

Commit fb58d56

Browse files
committed
fix: unreachable OIDC on dev mode
Signed-off-by: BoxBoxJason <contact@boxboxjason.dev>
1 parent 106e2c3 commit fb58d56

File tree

8 files changed

+235
-72
lines changed

8 files changed

+235
-72
lines changed

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,9 @@ backend:
270270
- AUTH_MODE=oidc_enforced
271271
- OIDC_PROVIDER_NAME=Authentik
272272
- OIDC_ISSUER_URL=https://auth.example.com/application/o/excalidash/
273+
# Optional split-horizon setup when backend reaches IdP via internal DNS.
274+
# Keep OIDC_ISSUER_URL browser-routable; set OIDC_DISCOVERY_URL for backend-only access.
275+
# - OIDC_DISCOVERY_URL=http://auth-internal:9000/application/o/excalidash/
273276
- OIDC_CLIENT_ID=your-client-id
274277
# Optional for public clients; required for confidential clients
275278
# - OIDC_CLIENT_SECRET=your-client-secret
@@ -287,6 +290,7 @@ Notes:
287290
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
288291
| OIDC-only (`oidc_enforced`) | You typically do not use local bootstrap admin registration; first admin can be created through your IdP depending on config. |
289292
| Reverse proxy | Set `FRONTEND_URL` and `TRUST_PROXY` correctly or auth + websockets may fail. |
293+
| Split-horizon IdP networking | Set `OIDC_ISSUER_URL` to the browser-reachable issuer and optionally `OIDC_DISCOVERY_URL` to a backend-reachable internal URL. |
290294
| OIDC admin mapping | If `OIDC_ADMIN_GROUPS` is set, admin role is reconciled on each authenticated request for OIDC users: users in those groups are promoted to `ADMIN`, users not in those groups are demoted to `USER`. |
291295
| Legacy sessions | Users with old sessions (issued before group claims were embedded) should sign out/in once so OIDC group claims are refreshed. |
292296

@@ -324,6 +328,8 @@ Configure ExcaliDash backend for hybrid OIDC:
324328
```bash
325329
cd backend
326330
cp .env.oidc.example .env
331+
# If backend runs in Docker and Keycloak issuer is localhost for browser, set:
332+
# OIDC_DISCOVERY_URL=http://keycloak:8080/realms/excalidash
327333
# Ensure OIDC_REDIRECT_URI matches where your frontend is running:
328334
# - http://localhost:6767/api/auth/oidc/callback (repo frontend dev default)
329335
# - https://excalidash.example.com/api/auth/oidc/callback (production)
@@ -468,6 +474,6 @@ Common flags:
468474
# Credits
469475

470476
- Example designs from:
471-
- https://github.com/Prakash-sa/system-design-ultimatum/tree/main
472-
- https://github.com/kitsteam/excalidraw-examples/tree/main
477+
- <https://github.com/Prakash-sa/system-design-ultimatum/tree/main>
478+
- <https://github.com/kitsteam/excalidraw-examples/tree/main>
473479
- [The amazing work of Excalidraw & contributors](https://www.npmjs.com/package/@excalidraw/excalidraw)

backend/.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ CSRF_SECRET=change-this-secret-in-production
3939
# OIDC Configuration (required when AUTH_MODE=hybrid or AUTH_MODE=oidc_enforced)
4040
# OIDC_PROVIDER_NAME=Authentik
4141
# OIDC_ISSUER_URL=https://auth.example.com/application/o/excalidash/
42+
# Optional: internal backend-only discovery URL for split-horizon networking.
43+
# Example: browser uses OIDC_ISSUER_URL=https://auth.example.com while backend discovers via http://auth:9000
44+
# OIDC_DISCOVERY_URL=http://auth-internal:9000/application/o/excalidash/
4245
# OIDC_CLIENT_ID=your-client-id
4346
# OIDC_CLIENT_SECRET=your-client-secret
4447
# OIDC_REDIRECT_URI=https://excalidash.example.com/api/auth/oidc/callback

backend/.env.oidc.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ AUTH_MODE=hybrid
1717

1818
OIDC_PROVIDER_NAME=Keycloak
1919
OIDC_ISSUER_URL=http://localhost:8080/realms/excalidash
20+
# Optional when backend runs in a container but Keycloak issuer is localhost for browser.
21+
# OIDC_DISCOVERY_URL=http://keycloak:8080/realms/excalidash
2022
OIDC_CLIENT_ID=excalidash
2123
OIDC_GROUPS_CLAIM=realm_access.roles
2224
# Example: Keycloak realm role used to grant ADMIN in ExcaliDash

0 commit comments

Comments
 (0)