Commit Graph
26 Commits
Author SHA1 Message Date
Alok Saldanha 3e5accad65 fixed linting and tests 2025-11-04 06:57:43 -05:00
Andy b9f4d35812 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
2025-10-29 14:04:25 -04:00
Alok Saldanha 2754bc1ef1 #81 Combined GATEWAY_ENABLE_ANNOTATIONS and GATEWAY_ENABLE_GENE_SETS flags 2023-07-06 08:53:19 -06:00
Alok Saldanha 8d8a0a3483 #68 close responses 2022-06-20 21:29:19 -04:00
Alok Saldanha 76f3939fdd rebased "Introduction of ItemSource interface" patch 2021-03-28 22:05:08 -04:00
Alok Saldanha 5404a8b0f3 removed trailing slash from render_annotations 2021-03-28 21:59:03 -04:00
Alok Saldanha d3ee04b6e5 blacken 2021-02-13 17:02:55 -05:00
Alok Saldanha f1f4b0c0ca added environment variables for ProxyFix 2021-02-13 16:42:34 -05:00
Gregor Sturm 9c17e2ff32 Fix redirect in cache_entry 2021-01-18 22:08:25 +01:00
Alok Saldanha 465373ca7e #30 black formatting 2020-09-08 21:11:59 -04:00
Alok Saldanha ce3eb0eedf Merge branch 'gmerge' into gmaster
# Conflicts:
#	cellxgene_gateway/backend_cache.py
#	cellxgene_gateway/cache_entry.py
#	cellxgene_gateway/env.py
#	cellxgene_gateway/gateway.py
#	cellxgene_gateway/subprocess_backend.py
#	tests/test_cache_entry.py
#	tests/test_dir_util.py
2020-08-30 13:47:22 -04:00
Alok Saldanha 9219336356 blackened code 2020-08-30 13:38:35 -04:00
Alok Saldanha b689357f29 Applied "Formatting and new enumeration for Cellxgene-gateway" patch 2020-08-30 13:36:39 -04:00
Alok Saldanha 61c7c43da7 blackened code 2020-08-16 17:07:23 -04:00
Alok Saldanha 8cdd23a57b #24 switched to absolute paths
relative paths won't necessarily work in css files
2020-08-16 16:17:28 -04:00
Alok Saldanha 486206bd32 #24 make static paths relative 2020-08-16 16:06:34 -04:00
Alok Saldanha bfa80f7ef8 #22 blackened code 2020-08-10 17:56:32 -04:00
Alok Saldanha 6c611f55dd #14 redirect prior to returning loading screen 2020-01-07 10:07:46 -05:00
Alok Saldanha c03098af17 #14 enabled new annotations
Due to issue with opening annotation files with "-" in the name, this doesn't quite work.
2019-12-28 21:55:43 -05:00
Alok Saldanha 9532375eb0 #12 introduce GATEWAY_PORT, rename GATEWAY_HOST and GATEWAY_PROTOCOL to EXTERNAL_HOST and EXTERNAL_PROTOCOL
Keep GATEWAY_HOST and GATEWAY_PROTOCOL for backwards compatibility (for now)
2019-11-17 19:03:47 -05:00
Alok Saldanha 66f7a6b5a7 #9 properly terminate all child processes 2019-10-29 21:19:18 -04:00
Alok Saldanha 820314adff #2 blackened 2019-09-17 11:06:50 -04:00
Alok Saldanha f7f49b3568 #2 added link to relaunch server on process error page 2019-09-17 11:05:22 -04:00
Alok Saldanha 2b259ab6b5 #2 added a way to relaunch a cellxgene server 2019-09-17 10:13:20 -04:00
Alok Saldanha a6c9456786 added support for gateway ttl and manual pruning 2019-09-16 17:12:29 -04:00
Eric Ma 952cb1e8e1 refactor to allow use with console entry points 2019-09-05 11:54:34 -04:00