mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-02 21:28:11 +08:00
Fix UnicodeDecodeError when viewing compressed datasets
When viewing datasets through the gateway, requests would fail with: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 1 The gateway was copying the accept-encoding header from browser requests when proxying to cellxgene backend servers. When accept-encoding is manually set, the Python requests library assumes the caller will handle decompression and leaves response content compressed. The cellxgene server responded with zstd-compressed content (magic bytes 28 b5 2f fd), but the gateway attempted to decode this compressed binary data as UTF-8 text, causing the decode error. Solution: Remove accept-encoding from the copied headers list in cache_entry.py. This allows the requests library to automatically handle compression negotiation and transparently decompress responses (gzip, deflate, brotli, zstd, etc.). This is the standard practice when proxying with requests and maintains all other gateway functionality (URL rewriting, auth, caching, etc.). Tested: - Dataset viewing works with compressed responses - File browser and static assets load correctly - URL rewriting continues to function properly
This commit is contained in:
@@ -148,7 +148,7 @@ class CacheEntry:
|
||||
headers = {}
|
||||
copy_headers = [
|
||||
"accept",
|
||||
"accept-encoding",
|
||||
# "accept-encoding" - removed: let requests library handle compression/decompression
|
||||
"accept-language",
|
||||
"cache-control",
|
||||
"connection",
|
||||
|
||||
Reference in New Issue
Block a user