nginx日志中打印响应报文

lua_need_request_body on;

set $resp_body “”;
body_filter_by_lua ’
local resp_body = string.sub(ngx.arg[1], 1, 1000)
ngx.ctx.buffered = (ngx.ctx.buffered or “”) .. resp_body
if ngx.arg[2] then
ngx.var.resp_body = ngx.ctx.buffered
end
‘;

你可能感兴趣的:(后台技术,nginx)