Is there a way to implement IP filtering or IP access rules much like I would with nginx/apache to restrict or block certain IPs on Heroku?
Note: I know this can be done from within my application (Rails 3.2) very easily but I don't think this is the most efficient use of my resources on Heroku. Also, a Rack based solution would be better than implementing the filtering in Rails.
I added 'rack-block' as Rack middleware. In config/initializers, add a new file:
YourApp::Application.configure do
config.middleware.insert_before(Rack::Lock, Rack::Block) do
# Add your rules with the rack-block syntax in here
end
end
Works like a charm.