From 06da86d897764ff065f598f2a669a967fb1a8bb1 Mon Sep 17 00:00:00 2001 From: Diogo Martins Date: Sat, 14 Feb 2026 17:33:05 +0000 Subject: [PATCH] Fix HAProxy - POST / --- src/Servers/HAProxyServer/echo.lua | 10 ++++++++++ src/Servers/HAProxyServer/haproxy.cfg | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/src/Servers/HAProxyServer/echo.lua b/src/Servers/HAProxyServer/echo.lua index 66fda45..05b5e79 100644 --- a/src/Servers/HAProxyServer/echo.lua +++ b/src/Servers/HAProxyServer/echo.lua @@ -12,3 +12,13 @@ core.register_service("echo", "http", function(applet) applet:start_response() applet:send(body) end) + +core.register_service("echo_body", "http", function(applet) + local body = applet:receive() + if body == nil then body = "" end + applet:set_status(200) + applet:add_header("Content-Type", "text/plain") + applet:add_header("Content-Length", tostring(#body)) + applet:start_response() + applet:send(body) +end) diff --git a/src/Servers/HAProxyServer/haproxy.cfg b/src/Servers/HAProxyServer/haproxy.cfg index 2eac5e9..fc01334 100644 --- a/src/Servers/HAProxyServer/haproxy.cfg +++ b/src/Servers/HAProxyServer/haproxy.cfg @@ -11,7 +11,11 @@ defaults frontend http_in bind *:8080 use_backend echo_backend if { path /echo } + use_backend post_echo_backend if { method POST } http-request return status 200 content-type "text/plain" string "OK" backend echo_backend http-request use-service lua.echo + +backend post_echo_backend + http-request use-service lua.echo_body