Im using OpenResty 1.9.7.4 on top of Ubuntu 14.04 and using is at as a reverse proxy for my webservers.
I want to do some string operation with the response after the proxy pass through the body_filter_by_lua_file while the compression directives are enabled. However, the response I get in the directive (ngx.arg[1]) is already compressed.
Here is my simplified server configuration:
root /var/www/html/example.com;
server_name .example.com;
access_log /var/www/html/example_com/access.log;
error_log /var/www/html/example_com/error.log;
underscores_in_headers on;
proxy_pass $scheme://$host;
body_filter_by_lua_file mod_body.lua;
gzip_types text/plain text/css application/_javascript_ text/xml application/xml+rss;
and this is the mod_body.lua for testing and verification
ngx.log(ngx.ERR,ngx.arg[1])
When I check my error.log file, I got the compressed content from the response. Because of that, I cant perform my usual string operations in the lua file.
Any other suggestions or workaround are mostly welcome.