http://railsauthority.com/tutorial/how-to-obtain-the-ip-address-of-the-current-user
http://ithelp.ithome.com.tw/question/10011184
- # 以 regular expression 的設法來指定可執行的 IP 或範圍
- unless request.env['HTTP_X_REAL_IP'] =~ /^192\.168\.1\.(101|204|77|9)$|^168\.95\.1\./
- render :text => '不准看!'
- end
沒有留言:
張貼留言