nginx lua reading content encoding header
ngx.var.http_content_encoding
- would return request's (not response's) header
API below work for read access in context of header_filter_by_lua_block
and later phases:
ngx.header.content_encoding
works for me always and is the right way.
If it doesn't work - check https://github.com/openresty/lua-nginx-module#lua_transform_underscores_in_response_headers
ngx.resp.get_headers()["Content-Encoding"]
also work, but not efficient to obtain single header.
To get the value from request use following
ngx.req.get_headers()["content_encoding"]