server {
server_name muacard.vn www.muacard.vn;
charset utf-8;
set $native_ssl 0;
.....
location / {
...
rewrite_by_lua_block {
cookie_erandom = ngx.var.cookie_erandom
cookie_etoken = ngx.var.cookie_etoken
remote_addr = ngx.var.remote_addr
request_uri = ngx.var.request_uri
domain ="muacard.vn"
if (cookie_erandom == nil) then
return ngx.redirect("/auth?m=er&dm=muacard.vn&url="" .. request_uri)
end
local etoken = ngx.md5(muacard .. remote_addr .. cookie_erandom)
if (cookie_etoken ~= etoken) then
return ngx.redirect("/auth?m=et&dm=muacard.vn&url="" .. request_uri)
end
}
....
}
server {
server_name testiq.vn www.testiq.vn;
charset utf-8;
.....
location / {
...
rewrite_by_lua_block {
cookie_erandom = ngx.var.cookie_erandom
cookie_etoken = ngx.var.cookie_etoken
remote_addr = ngx.var.remote_addr
request_uri = ngx.var.request_uri
domain ="testiq.vn"
if (cookie_erandom == nil) then
return ngx.redirect("/auth?m=er&dm=testiq.vn&url="" .. request_uri)
end
local etoken = ngx.md5(testiq .. remote_addr .. cookie_erandom)
if (cookie_etoken ~= etoken) then
return ngx.redirect("/auth?m=et&dm=testiq.vn&url="" .. request_uri)
end
}
.....
}