hachi029 opened a new issue, #13093:
URL: https://github.com/apache/apisix/issues/13093

   ### Current Behavior
   
   When using a logging plugin to record the response body, APISIX attempts to 
decompress uncompressed data, causing an warning messages in the error.log
   
   ### Expected Behavior
   
   APISIX only decompress compressed response bodies.
   
   ### Error Logs
   
   2026/03/17 09:17:47 [warn] 8028#8028: *41269 [lua] log-util.lua:417: 
collect_body(): try decode compressed data err: inflate gzip err: INFLATE: data 
error while sending to client, client: 127.0.0.1, server: _, request: "GET 
/file-logger HTTP/1.1", upstream: "http://127.0.0.1:9001/file-logger";, host: 
"127.0.0.1:9080", request_id: "68725bcdd1aff0fad2f7a907daa9ac06"
   
   ### Steps to Reproduce
   
   1. Run apisix with following router conf: 
   ```json
   {
       "uri": "/file-logger",
       "upstream": {
           "nodes": {
               "127.0.0.1:9001": 1
           },
           "type": "roundrobin"
       },
       "id": "1"
       "plugins": {
           "file-logger": {
               "path": "logs/file.log",
               "include_resp_body":true
           },
           "gzip": {
               "types": ["application/json"],
               "min_length": 10,
               "compression_level": 5
           }
       }
   }
   ```
   
   2. Start  another nginx server 127.0.0.1:9001  with following conf  :
   ```nginx
   location /file-logger {
           gzip off;
           content_by_lua_block {
               ngx.header.content_type = "application/json; charset=utf-8"
               ngx.say('{"code":"hello 123", "status":200}')
           }
    }
   ```
   3. Send request to APISIX: 
   ```bash
   curl -H 'Accept-Encoding: gzip' http://127.0.0.1:9080/file-logger
   ```
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - 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`):
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to