[PR #23876] [CLOSED] fix(openai): strip hop-by-hop headers from proxied SSE responses #43051

Closed
opened 2026-04-25 14:45:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23876
Author: @CodeLine9
Created: 4/19/2026
Status: Closed

Base: mainHead: clawoss/fix/merge-responses-content-decoding


📝 Commits (1)

  • f9db8b3 fix(openai): strip hop-by-hop headers from proxied SSE responses

📊 Changes

1 file changed (+9 additions, -1 deletions)

View changed files

📝 backend/open_webui/routers/openai.py (+9 -1)

📄 Description

Problem

Merge Responses (MOA) using Google/Anthropic API models fails with browser error ERR_CONTENT_DECODING_FAILED on the /api/v1/tasks/moa/completions endpoint. The request returns 200 OK but the browser cannot decode the body.

Root Cause

When proxying streaming responses from Anthropic/Google APIs through aiohttp, the session auto-decompresses the response body (default auto_decompress=True), but the upstream content-encoding: gzip header is forwarded unchanged. The browser receives a decoded plaintext body with a header claiming it is gzip-encoded, causing the decoding failure.

Fix

Strip hop-by-hop and transport headers (transfer-encoding, connection, content-encoding, content-length) from the forwarded StreamingResponse headers in generate_chat_completion. This mirrors the existing pattern already used in terminals.py.

Fixes #23855


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/23876 **Author:** [@CodeLine9](https://github.com/CodeLine9) **Created:** 4/19/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `clawoss/fix/merge-responses-content-decoding` --- ### 📝 Commits (1) - [`f9db8b3`](https://github.com/open-webui/open-webui/commit/f9db8b345af09d21e33b6fc7df6ba64d50c4956a) fix(openai): strip hop-by-hop headers from proxied SSE responses ### 📊 Changes **1 file changed** (+9 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/openai.py` (+9 -1) </details> ### 📄 Description ## Problem Merge Responses (MOA) using Google/Anthropic API models fails with browser error `ERR_CONTENT_DECODING_FAILED` on the `/api/v1/tasks/moa/completions` endpoint. The request returns 200 OK but the browser cannot decode the body. ## Root Cause When proxying streaming responses from Anthropic/Google APIs through aiohttp, the session auto-decompresses the response body (default `auto_decompress=True`), but the upstream `content-encoding: gzip` header is forwarded unchanged. The browser receives a decoded plaintext body with a header claiming it is gzip-encoded, causing the decoding failure. ## Fix Strip hop-by-hop and transport headers (`transfer-encoding`, `connection`, `content-encoding`, `content-length`) from the forwarded `StreamingResponse` headers in `generate_chat_completion`. This mirrors the existing pattern already used in `terminals.py`. Fixes #23855 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-25 14:45:49 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#43051