I've Rails apps, that record an IP-address from every request to specific URL, but in my IP database i've found facebook blok IP like 66.220.15.* and Google IP (i suggest it come from bot). Is there any formula to determine an IP from request was made by a robot or search engine spider ? Thanks
相关问题
- Question marks after images and js/css files in ra
- Using :remote => true with hover event
- Eager-loading association count with Arel (Rails 3
- Is there a way to remove IDV Tags from an AIFF fil
- Rails how to handle error and exceptions in model
相关文章
- Right way to deploy Rails + Puma + Postgres app to
- AWS S3 in rails - how to set the s3_signature_vers
- how to call a active record named scope with a str
- How to add a JSON column in MySQL with Rails 5 Mig
- “No explicit conversion of Symbol into String” for
- form_for wrong number of arguments in rails 4
- Rspec controller error expecting <“index”> but
- Rspec controller error expecting <“index”> but
Robots are required (by common sense / courtesy more than any kind of law) to send along a User-Agent with their request. You can check for this using
request.env["HTTP_USER_AGENT"]
and filter as you please.I think you can use browser gem for check bots.
https://github.com/fnando/browser
Another way is to use crawler_detect gem:
It can be useful if you want to detect a large various of different bots (more than 1000).
Since the well behaved bots at least typically include a reference URI in the UA string they send, something like:
is an easy way to see if the request is from a bot vs. a human user's agent. This seems to be more robust than trying to match against a comprehensive list.