luaページアクセス制限制御に基づく(黒い雲を転載)
if
($cookie_say !=
"hbnl"
){
add_header Set-Cookie
"say=hbnl"
;
rewrite .*
"$scheme://$host$uri"
redirect;
}
if
($cookie_say !=
"hbnl$remote_addr"
){
add_header Set-Cookie
"say=hbnl$remote_addr"
;
rewrite .*
"$scheme://$host$uri"
redirect;
}
rewrite_by_lua '
local
random = ngx.var.cookie_random
if
(random == nil)
then
random = math.random(999999)
end
local
token = ngx.md5(
"opencdn"
.. ngx.var.remote_addr .. random)
if
(ngx.var.cookie_token ~= token)
then
ngx.header[
"Set-Cookie"
] = {
"token="
.. token,
"random="
.. random}
return
ngx.redirect(ngx.var.scheme ..
"://"
.. ngx.var.host .. ngx.var.uri)
end
';
http://drops.wooyun.org/tips/734リファレンス