litellm - ✅(Solved) Fix [Bug]: SERVER_ROOT_PATH + package install (Poetry) still resolves UI logo assets incorrectly on v1.81.14 [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
BerriAI/litellm#25283Fetched 2026-04-08 03:02:12
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

PR fix notes

PR #25400: fix: rewrite absolute /ui/assets/ paths when SERVER_ROOT_PATH is set

Description (problem / solution / changelog)

What's the problem?

Fixes #25283.

When SERVER_ROOT_PATH is set (e.g. /web-llmgateway/v1), some compiled Next.js chunks emit absolute paths like "/ui/assets/logos/" that browsers resolve without the sub-path prefix, causing 404s for logo assets.

Two additional gaps found during review:

  1. Security: SERVER_ROOT_PATH was injected verbatim into served JS/HTML files at startup with no sanitization. A malicious env var value (e.g. with script tags) would be embedded permanently into static assets — stored XSS.
  2. Correctness: Only double-quoted paths ("/ui/assets/) were handled; single-quoted variants ('/ui/assets/) used in HTML/CSS were skipped silently.

What's the fix?

  • proxy_server.py: Add replacement for absolute "/ui/assets/ paths (double-quoted), and also for '/ui/assets/ (single-quoted)
  • utils.py: Add regex validation in get_server_root_path() — raises ValueError at startup if SERVER_ROOT_PATH contains characters outside ^(/[a-zA-Z0-9_-]+)*$, preventing injection into static assets

Tests

7 tests total in test_server_root_path_ui_assets.py:

  • test_absolute_ui_asset_paths_rewritten_with_server_root_path
  • test_litellm_asset_prefix_still_rewritten
  • test_no_replacement_when_no_server_root_path
  • test_binary_files_are_skipped
  • test_single_quoted_ui_asset_paths_rewritten (new)
  • test_invalid_server_root_path_raises_value_error (new — 4 malicious path variants)
  • test_valid_server_root_path_accepted (new — 5 valid path variants)

Checklist

  • Added tests in tests/test_litellm/
  • make test-unit passes locally

Changed files

  • litellm/proxy/proxy_server.py (modified, +25/-5)
  • litellm/proxy/utils.py (modified, +29/-17)
  • tests/test_litellm/proxy/test_server_root_path_ui_assets.py (added, +196/-0)
RAW_BUFFERClick to expand / collapse

Check for existing issues

  • I have searched the existing issues and checked that my issue is not a duplicate.

What happened?

When LiteLLM is installed via Poetry/package install (not Docker) and SERVER_ROOT_PATH=/web-llmgateway/v1, the Admin UI loads but logo assets are requested from:

/{SERVER_ROOT_PATH}/assets/logos/...

instead of:

/{SERVER_ROOT_PATH}/ui/assets/logos/...

This causes 404s for logos even though the files exist under /ui/assets/....

It may be a regression or an unresolved package-install-specific path rewriting issue.

Steps to Reproduce

  • Set `SERVER_ROOT_PATH
  • Open /{SERVER_ROOT_PATH}/ui/
  • UI loads, but browser requests /{SERVER_ROOT_PATH}/assets/logos/...
  • Direct request to /{SERVER_ROOT_PATH}/ui/assets/logos/google.svg returns 200
  • Direct request to /{SERVER_ROOT_PATH}/assets/logos/google.svg returns 404

Relevant log output

What part of LiteLLM is this about?

Proxy

What LiteLLM version are you on ?

v1.81.14

Twitter / LinkedIn details

No response

extent analysis

TL;DR

The issue can likely be fixed by adjusting the asset path configuration to include the /ui prefix for logo assets when SERVER_ROOT_PATH is set.

Guidance

  • Verify that the SERVER_ROOT_PATH environment variable is correctly set to /web-llmgateway/v1 and that the LiteLLM version v1.81.14 is compatible with the expected behavior.
  • Check the LiteLLM configuration files or documentation for any settings related to asset paths or URL rewriting that may need to be adjusted.
  • Test modifying the URL requests for logo assets to include the /ui prefix, as in /{SERVER_ROOT_PATH}/ui/assets/logos/..., to confirm that this resolves the 404 errors.
  • Consider reviewing the differences in behavior between Docker and Poetry/package installations to identify any potential discrepancies in configuration or environment variables.

Example

No code snippet is provided as the issue does not specify the programming language or framework used by LiteLLM.

Notes

The issue may be specific to the v1.81.14 version of LiteLLM, and upgrading to a later version could potentially resolve the issue. However, without further information, it is unclear whether this would fix the problem.

Recommendation

Apply workaround: Adjust the asset path configuration to include the /ui prefix for logo assets when SERVER_ROOT_PATH is set, as this is likely to resolve the 404 errors and allow the Admin UI to load correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING