From 82b15cada773b6457fe5a1c663ea228438a94d84 Mon Sep 17 00:00:00 2001 From: moicen Date: Sun, 7 May 2023 02:24:32 +0800 Subject: [PATCH] use ngx.var.host --- scripts/lib/upt.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/lib/upt.lua b/scripts/lib/upt.lua index 1bdedea..fca2543 100644 --- a/scripts/lib/upt.lua +++ b/scripts/lib/upt.lua @@ -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)