diff --git a/gateway/src/apicast/http_proxy.lua b/gateway/src/apicast/http_proxy.lua index 2bd914466..33f6bcd42 100644 --- a/gateway/src/apicast/http_proxy.lua +++ b/gateway/src/apicast/http_proxy.lua @@ -85,12 +85,20 @@ local function current_path(uri) end local function forward_https_request(proxy_uri, uri) + -- This is needed to call ngx.req.get_body_data() below. + ngx.req.read_body() + local request = { uri = uri, method = ngx.req.get_method(), headers = ngx.req.get_headers(0, true), path = current_path(uri), - body = http:get_client_body_reader(), + + -- We cannot use resty.http's .get_client_body_reader(). + -- The result of that is nil, and it results in a time-out in some + -- cases. Possibly because of this: + -- https://github.com/ledgetech/lua-resty-http/issues/31 + body = ngx.req.get_body_data(), } local httpc, err = http_proxy.new(request)