A rack middleware for handling search bot access, ip block, etc.
A rack middleware for controlling accesses by search bot or not, remote ip address, etc.
$ gem install rack-block
No doubt it depends on rack
(>= 1.3).
use Rack::Block do
bot_access do
halt 404
end
end
run App.new
use Rack::Block do
bot_access do
path '/secret/*' do
halt 404
end
end
end
run App.new
use Rack::Block do
ua_pattern /googlebot/i do
halt 404
end
end
run App.new
use Rack::Block do
ip_pattern '192.0.0.0' do
# expressions like '192.0.0.' also available
halt 404
end
end
run App.new
use Rack::Block do
bot_access do
path '/secret/*' do
redirect '/'
end
end
end
run App.new
use Rack::Block do
bot_access do
path '/secret/*' do
# TheDummy is a Rack-compatible app
double { TheDummy.new }
end
end
end
run App.new
More usage on RDoc: [http://rubydoc.info/github/udzura/rack-block/master/frames]
Or please look into spec/*
'192.0.0.0/24'
...Copyright (c) 2011 Uchio Kondo [email protected]. See LICENSE for further details.