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>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/23856
Author: @bobo-xxx
Created: 4/17/2026
Status: ❌ Closed
Base:
main← Head:fix/openai-strip-hop-by-hop-headers📝 Commits (1)
f7a8e40fix(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: gzipheader intact. When the server forwards this header with the already-decoded body, Chrome fails to parse it.Fix: Add
STRIPPED_RESPONSE_HEADERSconstant and filter hop-by-hop headers (transfer-encoding,connection,content-encoding,content-length) before forwarding the streaming response. This pattern is already used interminals.py.Changes:
STRIPPED_RESPONSE_HEADERS = frozenset(...)constant near line 63generate_chat_completionStreamingResponse before forwardingType of change**
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.