lua-resty-reqargs icon indicating copy to clipboard operation
lua-resty-reqargs copied to clipboard

Cannot proxy pass POST request with form-data body.

Open wechasing opened this issue 5 years ago • 0 comments

hi, when i'm using the reqargs to get post request data from form-data body, i cann't proxy pass the requests to the upstream, the nginx will return 504, my code is like this:

` local get, post, _ = require "resty.reqargs"()

-- do some return

do return end `

any advise? thanks

wechasing avatar Apr 22 '19 12:04 wechasing

@yondersever

Have you installed libnettle to your system?

bungle avatar Apr 22 '21 20:04 bungle

Hi @bungle

I'm having the same issue.

I would like to use nettle in a kong plugin that needs to decrypt using aes-256-gcm (Kong 1.5.1 on Ubuntu 18.04). I have libnettle6, libhogweed4 and libgmp10 installed with apt package manager. And I installed lua-resty-nettle successfully with: luarocks install lua-resty-nettle.

Importing the module with local aes = require "resty.nettle.aes" raises /usr/local/share/lua/5.1/resty/nettle/library.lua:55: unable to load nettle error message at kong init.

Any help would be greatly appreciated. Thank you

r-oueslati avatar Jul 31 '21 09:07 r-oueslati

Hi @bungle

I'm having the same issue.

I would like to use nettle in a kong plugin that needs to decrypt using aes-256-gcm (Kong 1.5.1 on Ubuntu 18.04). I have libnettle6, libhogweed4 and libgmp10 installed with apt package manager. And I installed lua-resty-nettle successfully with: luarocks install lua-resty-nettle.

Importing the module with local aes = require "resty.nettle.aes" raises /usr/local/share/lua/5.1/resty/nettle/library.lua:55: unable to load nettle error message at kong init.

Any help would be greatly appreciated. Thank you

wget https://ftp.gnu.org/gnu/nettle/nettle-3.4.1.tar.gz tar -zxf nettle-3.4.1.tar.gz cd nettle-3.4.1 ./configure --prefix=/usr --enable-mini-gmp && make make install

suochenxiao avatar Jul 14 '22 10:07 suochenxiao

Seems like the problem lies here in library.lua

local ffi = require "ffi"
local ffi_load = ffi.load
local ipairs = ipairs
local assert = assert
local pcall = pcall

local lib_path = _NETTLE_LIB_PATH -- luacheck: ignore
root@a27232cff808:/usr# luajit test.lua 
nil
luajit: test.lua:56: unable to load nettle
stack traceback:
        [C]: in function 'assert'
        test.lua:56: in main chunk
        [C]: at 0x5589e2257300

even after install nettle, it doesn't pick up the correct shared libraries. Once I hardcode the path in the script, I am able to load nettle.

local ffi = require "ffi"
local ffi_load = ffi.load
local ipairs = ipairs
local assert = assert
local pcall = pcall

_NETTLE_LIB_PATH = "/usr/local/nettle/3_5/lib64"
local lib_path = _NETTLE_LIB_PATH -- luacheck: ignore
root@a27232cff808:/usr# luajit test.lua 
/usr/local/nettle/3_5/lib64/

Maybe it would make sense to either use $PATH or allow setting an environment variable for this. I don't see how this lookup can work otherwise. Please correct me if I am missing something here. @bungle

AnshumanRohella avatar Mar 24 '23 02:03 AnshumanRohella