Skip to content

Fix Swagger UI path execute error with server_root_path in OpenAPI schema - #18947

Merged
1 commit merged into
BerriAI:litellm_staging_01_13_2026from
xfan001:litellm_fix_swagger_execute_for_custom_root_path
Jan 13, 2026
Merged

1 commit merged into
BerriAI:litellm_staging_01_13_2026from
xfan001:litellm_fix_swagger_execute_for_custom_root_path

Conversation

@xfan001

@xfan001 xfan001 commented Jan 12, 2026 •

Copy link
Copy Markdown
Contributor

Adds 'servers' field to OpenAPI schema when server_root_path is set, ensuring correct Swagger UI execute path for reverse proxies and subpath deployments. Includes tests to verify correct server URL handling for various root path formats.

Relevant issues

fix #16438

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

CI (LiteLLM team)

CI status guideline:

  • 50-55 passing tests: main is stable with minor issues.
  • 45-49 passing tests: acceptable but needs attention
  • <= 40 passing tests: unstable; be careful with your merges and assess the risk.
  • Branch creation CI run
    Link:

  • CI run for the last commit
    Link:

  • Merge / cherry-pick CI run
    Links:

Type

🆕 New Feature
🐛 Bug Fix
🧹 Refactoring
📖 Documentation
🚄 Infrastructure
✅ Test

Changes

  • litellm/proxy/proxy_server.py add
    if server_root_path:
        openapi_schema["servers"] = [{"url": "/" + server_root_path.strip("/")}]

@vercel

vercel Bot commented Jan 12, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
litellm Ready Ready Preview, Comment Jan 13, 2026 2:45am

@xfan001

xfan001 commented Jan 12, 2026

Copy link
Copy Markdown
Contributor Author

fix #16438

@CLAassistant

CLAassistant commented Jan 12, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@xfan001
xfan001 force-pushed the litellm_fix_swagger_execute_for_custom_root_path branch from 85bc660 to 64b0229 Compare January 13, 2026 02:38
Adds 'servers' field to OpenAPI schema when server_root_path is set, ensuring correct Swagger UI execute path for reverse proxies and subpath deployments. Includes tests to verify correct server URL handling for various root path formats.
@xfan001
xfan001 force-pushed the litellm_fix_swagger_execute_for_custom_root_path branch from 64b0229 to cae0cfd Compare January 13, 2026 02:43
@ghost
ghost changed the base branch from main to litellm_staging_01_13_2026 January 13, 2026 22:18
@ghost
ghost merged commit f8836cb into BerriAI:litellm_staging_01_13_2026 Jan 13, 2026
6 of 7 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…18947)

Adds 'servers' field to OpenAPI schema when server_root_path is set, ensuring correct Swagger UI execute path for reverse proxies and subpath deployments. Includes tests to verify correct server URL handling for various root path formats.
This pull request was closed.

This branch was successfully deployed

1 active deployment
Preview — cae0cfd6 Deployed Jan 13, 2026 by vercel[bot]
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.

[Bug]: custom server path (partially working)

2 participants