Hi, all, I am trying to do a rewrite_by_lua action by time. for example, only working time, my site opens, other time, redirect to a maintenance page.
I foud code in internet, like this
location / {
rewrite_by_lua '
local current_time = os.time()
local start_time = os.time({year=2019,month=10,day=10,hour=08,min=30,sec=0})
local end_time = os.time({year=2019,month=10,day=17,hour=17,min=00,sec=0})
if current_time <= start_time and current_time >= end_time then
return ngx.redirect("https://site.com/maintenance.html")
end
';}
but this code seems work from 2019.10.10 to 2019.10.17, not everyday.
So, how can I do this job?
Thanks.