What’s a good way to ban certain IPs from accessing a Rails app. For example, some crawlers/bots like to crawl the site and I’d like to handle this the best possible way.
My first thought is to add a before_filter to the application controller and if the request.remote_ip matches one of the banned IPs in the banned IPs array, then to redirect the user. But is there a better (more efficient) way? I suppose another way is to include the banned IPs in the server config file and deny them that way. Thanks for everyone’s suggestions!
This is related but separate from a similar topic on IpSpoofAttackError that I also opened today.