mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
feat: initial commit
This commit is contained in:
10
scripts/guard.lua
Normal file
10
scripts/guard.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
guard = {}
|
||||
|
||||
function guard.hello_world(applet)
|
||||
applet:set_status(200)
|
||||
local response = string.format([[<html><body>Hello World!</body></html>]], message);
|
||||
applet:add_header("content-type", "text/html");
|
||||
applet:add_header("content-length", string.len(response))
|
||||
applet:start_response()
|
||||
applet:send(response)
|
||||
end
|
5
scripts/register.lua
Normal file
5
scripts/register.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
package.path = package.path .. "./?.lua;/usr/local/etc/haproxy/scripts/?.lua"
|
||||
|
||||
require("guard")
|
||||
|
||||
core.register_service("hello-world", "http", guard.hello_world);
|
Reference in New Issue
Block a user