[PR #23856] [CLOSED] fix(openai): strip upstream hop-by-hop headers in MOA proxy #66266

Closed
opened 2026-05-06 12:31:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/23856
Author: @bobo-xxx
Created: 4/17/2026
Status: Closed

Base: mainHead: fix/openai-strip-hop-by-hop-headers


📝 Commits (1)

  • f7a8e40 fix(openai): strip upstream hop-by-hop headers in MOA proxy

📊 Changes

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

View changed files

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

📄 Description

Description

Fixes ERR_CONTENT_DECODING_FAILED when using 'Merge Responses' with Google/Anthropic models.

Root cause: aiohttp auto-decompresses the upstream response body but leaves the Content-Encoding: gzip header intact. When the server forwards this header with the already-decoded body, Chrome fails to parse it.

Fix: Add STRIPPED_RESPONSE_HEADERS constant and filter hop-by-hop headers (transfer-encoding, connection, content-encoding, content-length) before forwarding the streaming response. This pattern is already used in terminals.py.

Changes:

  • Add STRIPPED_RESPONSE_HEADERS = frozenset(...) constant near line 63
  • Filter headers in generate_chat_completion StreamingResponse before forwarding

Type of change**

  • Bug fix (non-breaking change which fixes an issue)

🔄 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/23856 **Author:** [@bobo-xxx](https://github.com/bobo-xxx) **Created:** 4/17/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/openai-strip-hop-by-hop-headers` --- ### 📝 Commits (1) - [`f7a8e40`](https://github.com/open-webui/open-webui/commit/f7a8e40b16679ba35232acb10acfcec547a4f265) fix(openai): strip upstream hop-by-hop headers in MOA proxy ### 📊 Changes **1 file changed** (+7 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/routers/openai.py` (+7 -1) </details> ### 📄 Description ## Description Fixes ERR_CONTENT_DECODING_FAILED when using 'Merge Responses' with Google/Anthropic models. **Root cause**: aiohttp auto-decompresses the upstream response body but leaves the `Content-Encoding: gzip` header intact. When the server forwards this header with the already-decoded body, Chrome fails to parse it. **Fix**: Add `STRIPPED_RESPONSE_HEADERS` constant and filter hop-by-hop headers (`transfer-encoding`, `connection`, `content-encoding`, `content-length`) before forwarding the streaming response. This pattern is already used in `terminals.py`. **Changes**: - Add `STRIPPED_RESPONSE_HEADERS = frozenset(...) ` constant near line 63 - Filter headers in `generate_chat_completion` StreamingResponse before forwarding ## Type of change** - [x] Bug fix (non-breaking change which fixes an issue) --- <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-05-06 12:31:35 -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#66266