Skip to content

bug: Skip brotli compression if upstream response is compressed  #10739

Description

@SilentEntity

Current Behavior

If the upstream response contains Content-Encoding header , then the data needs to be decompressed to compress it to brotli. Therefore, skipping the brotli compression for already compressed upstream data will avoid returning wrong encoded data in response from apisix.

Expected Behavior

Apisix should not compressed gzip or deflate upstream compressed data again in brotli. Skipping the compression will solve the issue.

Example:
If the upstream service is returning a response in gzip or header Content-Encoding: gzip. Return the same.

Error Logs

Not applicable.

Steps to Reproduce

  1. Build an Apisix master branch.
  2. Enable brotli plugin in global rules.
  3. One should have an upstream that returns a gzip or deflate encoded data.

Environment

  • APISIX version (run apisix version): master
  • Operating system (run uname -a): debian
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status
✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions