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
- Build an Apisix master branch.
- Enable brotli plugin in global rules.
- 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):
Current Behavior
If the upstream response contains
Content-Encodingheader , 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
gzipordeflateupstream compressed data again inbrotli. Skipping the compression will solve the issue.Example:
If the upstream service is returning a response in
gzipor headerContent-Encoding: gzip. Return the same.Error Logs
Not applicable.
Steps to Reproduce
Environment
apisix version): masteruname -a): debianopenresty -Vornginx -V):curl http://127.0.0.1:9090/v1/server_info):luarocks --version):