security - How do you block specific IP adress in Ruby on Rails -


I am in charge of some live websites made on Rail's Ruby. I have some IP ads that attack these sites and I would like to block my IP address. I know that they can get around this wall with a proxy, but I want to make it hard for myself and want to know where I should set in my Ruby on Rail app. Thanks to all of you!

  class ApplicationController & lt; ActionController :: Base before_filter: block_ip_addresses protected def block_ip_addresses head: unauthorized if current_ip_address == "XX.XX.XX.XX" end DEF current_ip_address request.env ['HTTP_X_REAL_IP'] || Thanks for request.env ['REMOTE_ADDR'] End End   

:

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -