3

How long is the timeout for facebook share cache. I edited all of my pages and changes must be reflected.

If timeout is unlimited, i have to debug all pages via curl etc.

Thanks.

tayhan
  • 37
  • 1
  • 5

2 Answers2

2

You can manually "clear" the facebook cache by using the Debugger.

Just go there, enter the url you changed and click "debug", that will cause the facebook bot to request the data from your servers even if it was already fetched and cached, and the new data will replace the old.


Edit

800k of pages is a lot, no doubt.

According to the Like Button doc:

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 URL Linter is the Debugger)

But from my experience it's not always the case, I haven't found any pattern to it, but I came across data that was months old and the cache was not clear until i manually used the debugger to extract the new data.

If you still want to manually refresh the data fb has, you can probably write a script that posts the url to the same form action in the Debugger page, I don't think they are using a csrf protection. In that way you can automate this action for all your pages, it might take a while, but nothing too serious.

Nitzan Tomer
  • 155,636
  • 47
  • 315
  • 299
0

I was using window.open('https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(url_to_share)) to make a share popup and no matter what I did, the cached share was not clearing until I did the following:

  • Put the URL you're trying to share into the Facebook URL Linter.
  • Scroll down to the "Share Preview"
  • Click "See this in the share dialog"
  • Copy the URL from that page
  • Put that URL in your window.open([put the url here]) popup and voila!
Alex W
  • 37,233
  • 13
  • 109
  • 109