backendUrl defaults to root-relative, breaking deployments behind a path-prefixing reverse proxy
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- typescript
- Domain
- frontend
Research direction
Start with URLUtil.getApiServerBaseUrl() and getBaseUrlWithoutPath() in src/utils/url-util.ts. Trace how runtimeConfig.backendUrl and window.location are used, then verify that an explicit backendUrl still wins and that the derived URL preserves the app's mount prefix. Run the existing URL-related tests and add coverage for prefixed deployments and OAuth redirect URLs.
Written by the indexing model from the issue text.
Description
Description
URLUtil.getApiServerBaseUrl() (src/utils/url-util.ts) returns runtimeConfig.backendUrl || ''. When no backendUrl is configured, the app falls back to root-relative API calls (e.g. GET /list-apps).
This breaks any deployment where the built adk-web bundle is served behind a path-prefixing reverse proxy that strips its prefix before forwarding to the backend — e.g. a proxy routing /agents/my-agent/* -> container (prefix stripped on the way in). The dev-ui itself loads fine at /agents/my-agent/dev-ui/, but its API calls go out root-relative to /list-apps, which the proxy has no route for → 404.
runtime-config.json is meant to be customized via set-backend.js, but that's a build-time script (npm run serve --backend=...) run against the source before ng build. Backends that embed an already-built adk-web bundle as a dependency artifact (e.g. adk-java's AdkWebServer, which serves classpath:/browser/** straight out of the google-adk-dev jar) have no build step to run this against and can't easily rewrite a file sealed inside a jar at runtime. So today there's no way for such a backend to get a correct backendUrl without patching the frontend itself.
This also affects getBaseUrlWithoutPath(), which hardcodes origin + '/dev-ui/' and drops any proxy prefix the same way (used as the OAuth redirectUri).
Proposed fix
When runtimeConfig.backendUrl isn't set, derive a same-origin default from window.location instead of defaulting to root-relative — specifically, preserve whatever path prefix the app was itself loaded under (i.e. strip the /dev-ui... suffix off location.pathname to recover the mount root, then default backendUrl to origin + mountRoot). This makes the bundle work behind any path-prefixing reverse proxy out of the box, for any backend embedding it, with no change needed on the backend side — while an explicit runtimeConfig.backendUrl (e.g. from set-backend.js in local dev) still takes precedence.
I have a fix + tests ready and will open a PR referencing this issue.
- Dominant language
- TypeScript
- Stars
- 1k
- Forks
- 266
- Avg merge
- 10d 13h
- Merged PRs (30d)
- 5
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from google/adk-web
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
refactor
Difficulty 2/5 Half a day Newbie friendliness 84/100
Maintainers usually reply within 5 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
OHDSI/Data2Evidence#3450 ·
Maintainers usually reply within 2 days
-
e2e-failure ready-to-code
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
redhat-developer/rhdh-plugin-export-overlays#4011 · 1 comment ·
Maintainers usually reply within 1 day
-
automation missing-model model-sync provider:ofox
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
anomalyco/models.dev#8421 ·
Maintainers usually reply within 1 day
-
SlackAdapter and TelegramAdapter are not assignable to Adapter under exactOptionalPropertyTypesOpen
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day