Skip to content

fix(ui): use runtime ROOT_PATH for API base URL (#95)#96

Merged
rbardaji merged 2 commits intomainfrom
fix/95-ui-root-path-runtime-config
Apr 8, 2026
Merged

fix(ui): use runtime ROOT_PATH for API base URL (#95)#96
rbardaji merged 2 commits intomainfrom
fix/95-ui-root-path-runtime-config

Conversation

@rbardaji
Copy link
Copy Markdown
Collaborator

@rbardaji rbardaji commented Apr 8, 2026

Summary

Fixes #95 — The React UI was not using ROOT_PATH when making API calls, causing 404 errors behind a reverse proxy with a path prefix (e.g., /ep-api).

Changes

  • entrypoint.sh (new): Generates /app/ui/build/config.js at container startup with the ROOT_PATH value from the environment
  • ui/public/index.html: Loads config.js before the React app starts
  • ui/src/services/api.js: Reads base URL from window.__EP_CONFIG__.rootPath instead of build-time REACT_APP_API_BASE_URL
  • Dockerfile.allinone: Uses entrypoint.sh instead of launching supervisord directly

How it works

  1. Container starts → entrypoint.sh runs
  2. Script writes window.__EP_CONFIG__ = { rootPath: "/ep-api" }; to /app/ui/build/config.js
  3. index.html loads this script before React boots
  4. api.js picks up the rootPath as the axios base URL
  5. Supervisord launches nginx + uvicorn as before

To change the prefix, just update ROOT_PATH in .env and restart — no rebuild needed.

Test plan

  • All 1011 tests pass
  • Container starts correctly with entrypoint.sh
  • config.js is generated with correct ROOT_PATH value

Raul Bardaji added 2 commits April 8, 2026 05:41
… env (#95)

Add entrypoint.sh that generates config.js with ROOT_PATH at container
startup, so the UI can discover the API prefix without rebuilding.
@rbardaji rbardaji merged commit c394b6d into main Apr 8, 2026
1 check passed
@rbardaji rbardaji deleted the fix/95-ui-root-path-runtime-config branch April 8, 2026 11:43
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.

UI does not use ROOT_PATH for API calls behind reverse proxy

1 participant