mirror of
https://gitgud.io/fatchan/haproxy-protection.git
synced 2025-05-09 02:05:37 +00:00
Merge branch 'master' into kikeflare
This commit is contained in:
@ -228,14 +228,14 @@ function _M.view(applet)
|
|||||||
local user_hash = utils.generate_secret(applet, captcha_cookie_secret, user_key, true)
|
local user_hash = utils.generate_secret(applet, captcha_cookie_secret, user_key, true)
|
||||||
local signature = sha.hmac(sha.sha256, hmac_cookie_secret, user_key .. user_hash)
|
local signature = sha.hmac(sha.sha256, hmac_cookie_secret, user_key .. user_hash)
|
||||||
local combined_cookie = user_key .. "#" .. user_hash .. "#" .. signature
|
local combined_cookie = user_key .. "#" .. user_hash .. "#" .. signature
|
||||||
local secure_cookie_flag = "true"
|
local secure_cookie_flag = " Secure=true;"
|
||||||
if applet.sf:ssl_fc() == "0" then
|
if applet.sf:ssl_fc() == "0" then
|
||||||
secure_cookie_flag = "false"
|
secure_cookie_flag = ""
|
||||||
end
|
end
|
||||||
applet:add_header(
|
applet:add_header(
|
||||||
"set-cookie",
|
"set-cookie",
|
||||||
string.format(
|
string.format(
|
||||||
"z_ddos_captcha=%s; expires=Thu, 31-Dec-37 23:55:55 GMT; Path=/; SameSite=Strict; Secure=%s;",
|
"z_ddos_captcha=%s; Expires=Thu, 31-Dec-37 23:55:55 GMT; Path=/; SameSite=Strict;",
|
||||||
combined_cookie,
|
combined_cookie,
|
||||||
secure_cookie_flag
|
secure_cookie_flag
|
||||||
)
|
)
|
||||||
|
Reference in New Issue
Block a user