From 6087320fd76bb0cc4aa6ba5a42528edd963aa7ff Mon Sep 17 00:00:00 2001 From: C0nw0nk Date: Sun, 2 Feb 2020 18:55:54 +0000 Subject: [PATCH] Update anti_ddos_challenge.lua Add feature to automatically detect if website we are serving traffic for is a Tor network website via the .onion domain extension and switch our compatibility to accomadate for Tor clients. --- lua/anti_ddos_challenge.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lua/anti_ddos_challenge.lua b/lua/anti_ddos_challenge.lua index c779c5c..fb00e9e 100644 --- a/lua/anti_ddos_challenge.lua +++ b/lua/anti_ddos_challenge.lua @@ -285,6 +285,10 @@ if ip_blacklist_remote_addr == "auto" then ip_blacklist_remote_addr = ngx.var.remote_addr end end +--if host of site is a tor website connecting clients will be tor network clients +if string.match(string.lower(ngx.var.host), ".onion") then + remote_addr = "tor" +end if remote_addr == "tor" then remote_addr = ngx.var.http_user_agent end