Skip to content

fix(ui): point the prod build at Keycloak on its own origin, /auth - #49

Merged
tarannum-2002 merged 1 commit into
mainfrom
fix/ui-keycloak-same-origin
Nov 13, 2026
Merged

tarannum-2002 merged 1 commit into
mainfrom
fix/ui-keycloak-same-origin

Conversation

@tarannum-2002

Copy link
Copy Markdown
Contributor

What

ui/Dockerfile.prod now defaults VITE_KEYCLOAK_URL to /auth instead of http://localhost:8081/auth.

Why

Vite bakes VITE_* into the bundle at build time, and CI builds with the defaults, so every published knowledge-provider-ui image sent the login redirect to localhost:8081: the viewer's own machine. On Kubernetes, Keycloak is served at /auth on the same host as the UI (/knowledge-provider/). The UI builds its authorize and logout URLs by hand (no keycloak-js), so a relative URL resolves against the page's origin and the browser lands on the right Keycloak. One image works on every host laid out this way, with no per-environment build.

A host with Keycloak somewhere else can still pass --build-arg VITE_KEYCLOAK_URL=.... docker-compose.yml already passes its own value, so local compose is unchanged.

Testing

  • Read ui/src/auth/keycloak.js: authorizeUrl and the logout URL are ${keycloakUrl}/realms/... passed to window.location.assign, which accepts a relative path. isKeycloakConfigured only checks the value is non-empty.
  • To be verified on dev once CI publishes main: UI at https://65.2.99.2.sslip.io/knowledge-provider/, login redirects to /auth/realms/docs-pipeline/....

🤖 Generated with Claude Code

@codecov

codecov Bot commented Nov 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@tarannum-2002
tarannum-2002 merged commit cc890e7 into main Nov 13, 2026
3 checks passed
@tarannum-2002
tarannum-2002 deleted the fix/ui-keycloak-same-origin branch November 13, 2026 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant