Hello
The following configuration does not work - ngx.arg[1] is empty all the time and the "xxx" response body is returned to client. I'd expect the body_filter_by_lua to change the response body to "XXX".
server {
server_name test.localhost;
location /source {
return 200 "xxx";
}
location / {
echo_location /source;
# update response body
body_filter_by_lua_block {
ngx.log(ngx.ERR, "[body_filter_by_lua_block] ngx.arg[1]: "..ngx.arg[1])
ngx.arg[1] = string.upper(ngx.arg[1])
}
}
}
logged messages:
2023/01/25 10:16:51 [error] 8#8: *1 [lua] body_filter_by_lua:2: [body_filter_by_lua_block] ngx.arg[1]: , client: 127.0.0.1, server: test.localhost, request: "GET / HTTP/1.1", host: "test.localhost"
2023/01/25 10:16:51 [error] 8#8: *1 [lua] body_filter_by_lua:2: [body_filter_by_lua_block] ngx.arg[1]: , client: 127.0.0.1, server: test.localhost, request: "GET / HTTP/1.1", host: "test.localhost"
nginx version: 1.22.0
ngx_http_echo_module version: master from git
ngx_http_lua_module version: v0.10.19
--
best regards
Przemysław Sobala