Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4849

Response body is coming as nil using register_fetches and lua

$
0
0

Hi,
I am trying to intercept the response body of HTTP requests in a lua script using the register_fetches core API.
My lua code is as follows:

local function resp_filter(txn)
	local payload = txn.f:req_body()
	if payload ~= nil then
		core.Info("** Response " .. payload .. "\n")
	else
		core.Info("** Response is nil")
	end	
end
core.register_fetches("resp_filter", resp_filter)

I am calling the function as follows from config file

http-response   set-var(txn.req_body) lua.resp_filter

However I am getting the response body as nil for versions 1.9.7 - 2.1.12. It is working fine for versions outside of this bracket.

NOTE: The API was changed from req.body to res.body post version 2.2.

Why is the req.body returning nil for the versions mentioned above but is working fine prior to those releases?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 4849

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>