mirror of
https://github.com/open-webui/open-webui.git
synced 2026-09-11 22:52:54 +00:00
fix: stop forwarding upstream Server and Date headers from the terminal proxy (#29841)
Proxied terminal responses (GET /api/v1/terminals/{id}/ports and every other
proxied route) went out with two Server and two Date headers: the terminal
server's copies, forwarded verbatim, plus uvicorn's own. nginx in front of Open
WebUI logs "upstream sent duplicate header line" for both on every request, and
the ports route is polled often enough to fill gigabytes of error log per day.
Server and Date belong to whoever terminates the connection, so the proxy now
drops the upstream's copies next to the framing headers it already stripped.
uvicorn's own values still go out, once. Everything else, including custom
upstream headers and TERMINAL_PROXY_HEADERS, passes through unchanged.
The OpenAI and Ollama proxies forward upstream Server and Date the same way and
are left for a separate change.
Fixes #29824
This commit is contained in:
parent
1b67da7004
commit
c955cbd2c5
1 changed files with 4 additions and 1 deletions
|
|
@ -39,7 +39,10 @@ log = logging.getLogger(__name__)
|
|||
router = APIRouter()
|
||||
|
||||
STREAMING_CONTENT_TYPES = ('application/octet-stream', 'image/', 'application/pdf')
|
||||
STRIPPED_RESPONSE_HEADERS = frozenset(('transfer-encoding', 'connection', 'content-encoding', 'content-length'))
|
||||
# Drop the upstream's server and date: uvicorn adds its own and forwarding both duplicates them.
|
||||
STRIPPED_RESPONSE_HEADERS = frozenset(
|
||||
('transfer-encoding', 'connection', 'content-encoding', 'content-length', 'server', 'date')
|
||||
)
|
||||
|
||||
|
||||
def _sanitize_proxy_path(path: str) -> str | None:
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue