mirror of
https://github.com/C0nw0nk/Nginx-Lua-Anti-DDoS.git
synced 2023-12-14 04:31:21 +00:00
Update anti_ddos_challenge.lua
Fix for Javascript refreshing the page before the browser has a chance to set the cookies in response. Fix to stop Firefox browsers message "firefox prevented this page from automatically reloading" Remove un-used junk code.
This commit is contained in:
@@ -456,13 +456,6 @@ local user_agent = ngx.var.http_user_agent --user agent of browser
|
|||||||
local expected_header_status = 200
|
local expected_header_status = 200
|
||||||
local authentication_page_status_output = 503
|
local authentication_page_status_output = 503
|
||||||
|
|
||||||
local domain = ""
|
|
||||||
if host == nil then
|
|
||||||
domain = host:match("[%w%.]*%.(%w+%.%w+)") --Remove subdomains from the server_name (host) to output .domain.com
|
|
||||||
else
|
|
||||||
domain = "localhost"
|
|
||||||
end
|
|
||||||
|
|
||||||
local answer = calculate_signature(remote_addr) --create our encrypted unique identification for the user visiting the website.
|
local answer = calculate_signature(remote_addr) --create our encrypted unique identification for the user visiting the website.
|
||||||
|
|
||||||
if x_auth_header == 2 then --if x-auth-header is dynamic
|
if x_auth_header == 2 then --if x-auth-header is dynamic
|
||||||
@@ -634,8 +627,10 @@ local javascript_anti_ddos = [[
|
|||||||
//end javascript puzzle
|
//end javascript puzzle
|
||||||
var xhttp = new XMLHttpRequest();
|
var xhttp = new XMLHttpRequest();
|
||||||
xhttp.onreadystatechange = function() {
|
xhttp.onreadystatechange = function() {
|
||||||
document.getElementById("status").innerHTML = "Refresh your page.";
|
if (xhttp.readyState === 4) {
|
||||||
location.reload(true);
|
document.getElementById("status").innerHTML = "Refresh your page.";
|
||||||
|
location.reload(true);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
xhttp.open("]] .. javascript_REQUEST_TYPE .. [[", "]] .. request_uri .. [[", true);
|
xhttp.open("]] .. javascript_REQUEST_TYPE .. [[", "]] .. request_uri .. [[", true);
|
||||||
]] .. javascript_REQUEST_headers .. [[
|
]] .. javascript_REQUEST_headers .. [[
|
||||||
@@ -733,7 +728,6 @@ local anti_ddos_html_output = [[
|
|||||||
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
|
||||||
<meta name="robots" content="noindex, nofollow" />
|
<meta name="robots" content="noindex, nofollow" />
|
||||||
<meta http-equiv="refresh" content="]] .. refresh_auth+2 .. [[">
|
|
||||||
<title>]] .. title .. [[</title>
|
<title>]] .. title .. [[</title>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
]] .. style_sheet .. [[
|
]] .. style_sheet .. [[
|
||||||
|
Reference in New Issue
Block a user