Ruby on Rails, How to determine if a request was made by a robot or search engine spider?

后端 未结 4 1704
有刺的猬
有刺的猬 2020-12-13 21:24

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

4条回答
  •  [愿得一人]
    2020-12-13 21:46

    I think you can use browser gem for check bots.

    if browser.bot?
      # code here
    end
    

    https://github.com/fnando/browser

提交回复
热议问题