litellm/litellm/proxy/middleware
kenneth-berri 66b923b51d
feat(proxy): let operators omit x-litellm-* response headers (#52949)
* feat(proxy): optionally omit LiteLLM response headers across HTTP paths

Signed-off-by: Jaeyeon Kim <anencore94@gmail.com>

* fix(proxy): preserve typed headers without rebinding messages

Signed-off-by: Jaeyeon Kim <anencore94@gmail.com>

* refactor(proxy): inject the header opt-out setting into the middleware

* fix(proxy): apply the header opt-out to unhandled 500 responses

The unhandled exception handler runs outside the middleware stack, so its x-litellm-call-id header was not filtered. Also type the middleware test.

* refactor(proxy): share one typed header opt-out check

A named function replaces the lambda so the type gate stays at its merge-base count, and the 500 handler filters raw headers in place.

---------

Signed-off-by: Jaeyeon Kim <anencore94@gmail.com>
Co-authored-by: Jaeyeon Kim <anencore94@gmail.com>
2026-11-19 15:27:34 -08:00
..
admission_control_middleware.py refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
billable_request_metrics_middleware.py refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
budget_reservation_release_middleware.py fix(proxy): release unclaimed budget reservations at request end (#42304) 2026-09-21 19:51:12 -07:00
gzip_middleware.py fix(proxy): limit gzip to dashboard analytics and offload compression (#46712) 2026-10-15 17:27:03 -07:00
in_flight_requests_middleware.py refactor(typing): clear 1143 basedpyright Any errors across 273 files (#46574) 2026-10-15 21:08:47 +00:00
litellm_response_headers_middleware.py feat(proxy): let operators omit x-litellm-* response headers (#52949) 2026-11-19 15:27:34 -08:00
per_request_root_path_middleware.py refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
prometheus_auth_middleware.py refactor(types): replace Any with proven types in 157 files (#44798) 2026-10-06 15:31:54 +00:00
redis_request_batch_middleware.py refactor(redis): delete the Python RedisBatch now that every request op is native (#51383) 2026-11-13 03:22:28 +00:00
request_body_decompression_middleware.py feat(skills): upload local skill ZIPs from the dashboard (#50008) 2026-11-04 00:56:40 -08:00
request_size_limit_middleware.py refactor(typing): clear 1141 basedpyright Any errors across 182 files (#50711) 2026-11-11 22:11:47 +00:00
security_headers_middleware.py feat(lint): enforce Final on locals and freeze function parameters (LIT010, LIT011) 2026-08-04 12:54:39 -07:00