use ngx.var.host

This commit is contained in:
moicen
2023-05-07 02:24:32 +08:00
parent 5dcccae37d
commit 82b15cada7
+5 -5
View File
@@ -6,17 +6,17 @@ local _M = {}
function _M.upt(uri)
local hostname = ngx.var.host
ngx.log(ngx.INFO, 'hostname...', hostname)
local secret;
if (hostname == 'moicen.com') then
if string.find(hostname, "moicen.com") then
secret = ngx.var.upt_moicen_secret
elseif hostname == "alchemy-studio.cn" then
elseif string.find(hostname, "alchemy-studio.cn") then
secret = ngx.var.upt_alchemy_secret
elseif hostname == "huiwings.cn" then
elseif string.find(hostname, "huiwings.cn") then
secret = ngx.var.upt_huiwings_secret
end
ngx.log(ngx.INFO, 'url...' .. uri .. ' host...' .. hostname .. 'secret...' .. secret)
ngx.log(ngx.INFO, 'secret...' .. secret)
local duration = ngx.var.upt_duration
local etime = os.time() + duration
local sign = ngx.md5(secret .. '&' .. etime .. '&' .. uri)