fix: apply server root path to mapped passthrough route matching#22310
Open
umut-polat wants to merge 1 commit intoBerriAI:mainfrom
Open
fix: apply server root path to mapped passthrough route matching#22310umut-polat wants to merge 1 commit intoBerriAI:mainfrom
umut-polat wants to merge 1 commit intoBerriAI:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
Contributor
Greptile SummaryThis PR fixes a bug where mapped pass-through routes (e.g.,
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| litellm/proxy/pass_through_endpoints/pass_through_endpoints.py | One-line fix applies _build_full_path_with_root to mapped pass-through routes, matching the pattern already used for DB-registered routes 15 lines below. Correct and consistent. |
| tests/test_litellm/proxy/pass_through_endpoints/test_pass_through_endpoints.py | Regression test verifies that mapped routes (vertex_ai, bedrock) match when SERVER_ROOT_PATH is set. Uses mocks only — no real network calls. Test covers both prefixed and bare routes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["Incoming request<br>/litellm/vertex_ai/v1/projects/foo"] --> B["is_registered_pass_through_route(route)"]
B --> C{"Check mapped routes<br>(vertex_ai, bedrock, etc.)"}
C -->|"Before fix"| D["Compare: /litellm/vertex_ai/...<br>startswith /vertex_ai ❌"]
D --> E["Falls through → 404"]
C -->|"After fix"| F["_build_full_path_with_root(/vertex_ai)<br>→ /litellm/vertex_ai"]
F --> G["Compare: /litellm/vertex_ai/...<br>startswith /litellm/vertex_ai ✅"]
G --> H["Return True"]
B --> I{"Check DB-registered routes<br>(already used _build_full_path_with_root)"}
I --> J["Return True/False"]
Last reviewed commit: 9712843
mapped passthrough routes (vertex_ai, bedrock, etc) were compared against the raw request path without prepending SERVER_ROOT_PATH. db-registered routes already used _build_full_path_with_root for this but the mapped routes branch was missed. fixes BerriAI#22272
9712843 to
9e7f7d1
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mapped passthrough routes (vertex_ai, bedrock, etc) were compared against the raw request path without prepending SERVER_ROOT_PATH. db-registered routes already used _build_full_path_with_root for this — the mapped routes branch was missed.
when a reverse proxy forwards
/litellm/vertex_ai/...andSERVER_ROOT_PATH=/litellm, the route check fell through because it compared/litellm/vertex_ai/...against bare/vertex_ai.one-line fix: run
_build_full_path_with_rooton each mapped route before the startswith check — same pattern already used 15 lines below for db routes.test added covering prefixed and bare routes with a custom root.
fixes #22272