Hi,
applet.sf:hdr(name) always returns empty strings in POST requests. It works
only in GET requests.
To reproduce:
haproxy.cfg:
global
...
lua-load /etc/haproxy/test.lua
...
frontend http
bind *:8081
mode http
acl applet_test_url path /applet-test
http-request use-service lua.applet-test if applet_test_url
default_backend be
...
test.lua:
-- applet test endpoint
core.register_service("applet-test", "http", function(applet)
local headerContentType = applet.sf:hdr("Content-Type")
core.Info("headerContentType:" .. headerContentType)
local headerUserAgent = applet.sf:hdr("User-Agent")
core.Info("headerUserAgent:" .. headerUserAgent)
local src = applet.sf:src()
core.Info("src:" .. src)
local response = headerContentType .. " + " .. headerUserAgent .. " + " ..
src
applet:set_status(200)
applet:add_header("content-length", string.len(response))
applet:add_header("content-type", "text/plain")
applet:start_response()
applet:send(response)
end)
curl -X GET -H "Content-Type: text/plain" http://127.0.0.1:8081/applet-test
==> applet.sf:hdr() returns the correct values
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d
"key=value" http://127.0.0.1:8081/applet-test
==> applet.sf:hdr() returns empty strings