coolboywcm opened a new issue, #9961:
URL: https://github.com/apache/apisix/issues/9961
### Current Behavior
Version: APISIX/3.1.0
After enabling the http-logger plug-in, if response has been compress by
gzip, the response body receives garbled characters
The configuration is as follows
"http-logger": {
"_meta": {
"disable": false
},
"include_resp_body": true,
"uri": "http://xxx.xx.xx.xx:80/apisix/addLog"
}
See the response body by http-logger:
"response": {
"body":"\u001F�\b\u0000\u0000\u0000\u0000\u0000\u0000\u0000�V�N�4T�R242626Q�\u0005\u0000��_�\u0011\u0000\u0000\u0000",
"headers": {
"content-encoding": "gzip",
"content-length": "37",
"content-type": "application/json;charset=UTF-8",
"date": "Thu, 03 Aug 2023 06:32:24 GMT",
"server": "APISIX/3.1.0",
........
},
"size": 377,
"status": 200
}
The upstream server uses gzip to compress the response, and the http-logger
plug-in records the response-body, directly converting the gzip content into a
string, resulting in garbled characters
### Expected Behavior
"response": {
"body":{"key1": "123234"},
"headers": {
"content-encoding": "gzip",
"content-length": "37",
"content-type": "application/json;charset=UTF-8",
"date": "Thu, 03 Aug 2023 06:32:24 GMT",
"server": "APISIX/3.1.0",
........
},
"size": 377,
"status": 200
}
### Error Logs
_No response_
### Steps to Reproduce
Open the plug-in http-logger in route
Call the route interface
View the http-logger uri server console and view the log message
### Environment
APISIX version (3.1.0):
Operating system (CentOS Linux release 7.6.1810):
OpenResty / Nginx version (nginx version: openresty/1.21.4.1):
etcd version, if relevant ("etcd_version":"3.4.0"):
APISIX Dashboard version, if relevant(3.0.0)
--
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]