Hello,
I'm trying to use zlib to decompress with a lua script the responses of a server I'm proxying: Here is the part of the code where I'm doing the "required":
header_filter_by_lua '
if ngx.header.content_encoding == "gzip" then
local zlib = require "zlib"
ngx.ctx.inflate = zlib.inflate()
ngx.header.content_length = nil
ngx.header.content_encoding = nil
end
';
I have (https://github.com/brimworks/lua-zlib) installed on my machine and working (I can tell that because I can open on a CMD the lua interpreter and execute without problems. However it doesn't seem to be working on OpenResty and have no idea on how to properly install it. Here's the log of the error:
2016/11/21 17:28:26 [error] 14820#14264: *23 failed to run header_filter_by_lua*: header_filter_by_lua:3: module 'zlib' not found:
no field package.preload['zlib']
no file './site/lualib/zlib.lua'
no file './site/lualib/zlib/init.lua'
no file './lualib/zlib.lua'
no file './lualib/zlib/init.lua'
no file '.\zlib.lua'
no file 'C:\OpenResty\lualib\zlib.lua'
no file 'C:\OpenResty\lua\zlib.lua'
no file 'C:\OpenResty\lua\zlib\init.lua'
no file './site/lualib/zlib.so'
no file './lualib/zlib.so'
no file '.\zlib.dll'
no file 'C:\OpenResty\lualib\zlib.so'
no file 'C:\OpenResty\zlib.dll'
no file 'C:\OpenResty\loadall.dll'
stack traceback:
[C]: in function 'require'
header_filter_by_lua:3: in function <header_filter_by_lua:1> while reading response header from upstream, client: 127.0.0.1, server: localhost, request: "GET / HTTP/1.1", upstream: "http://92.123.73.10:80/", host: "localhost:8080"
2016/11/21 17:30:02 [error] 14956#13520: *1 failed to run header_filter_by_lua*: error loading module 'zlib' from file '.\zlib.dll':
The specified procedure could not be found.
How can I properly install zlib support for OpenResty?
Thank you,
David