mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Support multiple backends per domain with the help of some lua
This commit is contained in:
@@ -7,3 +7,16 @@ core.register_action("captcha-check", { 'http-req', }, bot_check.check_captcha_s
|
||||
core.register_action("pow-check", { 'http-req', }, bot_check.check_pow_status)
|
||||
core.register_action("decide-checks-necessary", { 'http-req', }, bot_check.decide_checks_necessary)
|
||||
core.register_action("kill-tor-circuit", { 'http-req', }, bot_check.kill_tor_circuit)
|
||||
|
||||
local backends_map = Map.new('/etc/haproxy/map/backends.map', Map._str)
|
||||
function get_server_names(txn)
|
||||
local key = txn.sf:hdr("Host")
|
||||
local value = backends_map:lookup(key or "")
|
||||
if value ~= nil then
|
||||
return value
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
core.register_fetches("get_server_names", get_server_names)
|
||||
|
Reference in New Issue
Block a user