为了在我们的预览环境中测试 Open Graph API,我们需要在我们的防火墙上挖一个洞,让 Facebook 抓取我们的对象页面。我们应该允许哪些 IP 范围?
最佳答案
编辑
Facebook 一直表现出一些爱心,现在正在向任何人公开 IP 块
http://developers.facebook.com/docs/ApplicationSecurity/#facebook_scraper
https://developers.facebook.com/docs/sharing/best-practices#crawl
Facebook Scraper
A number of Platform services such as Social Plugins and the Open Graph require our systems to be able to reach your Web Pages. We recognize that there are situations where you might not want these pages on the public Internet, during testing or for other security reasons.
To facilitate this, you should make exceptions in your security systems to allow Facebook to scrape these pages by adding the following IP ranges, accurate as of April 2012.
31.13.24.0/21 31.13.64.0/18 66.220.144.0/20 69.63.176.0/20 69.171.224.0/19 74.119.76.0/22 103.4.96.0/22 173.252.64.0/18 204.15.20.0/22
除了 IP,您还可以为防火墙使用用户代理。
http://developers.facebook.com/docs/reference/plugins/like/
When does Facebook scrape my page?
Facebook needs to scrape your page to know how to display it around the site.
Facebook scrapes your page every 24 hours to ensure the properties are up to date. The page is also scraped when an admin for the Open Graph page clicks the Like button and when the URL is entered into the Facebook URL Linter. Facebook observes cache headers on your URLs - it will look at "Expires" and "Cache-Control" in order of preference. However, even if you specify a longer time, Facebook will scrape your page every 24 hours.
The user agent of the scraper is: "facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)"
关于facebook-graph-api - Facebook 的 Open Graph 爬虫的 IP 地址范围是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8859013/