Facebook and Whatsapp meta tag cache issue

Varun Sukheja picture Varun Sukheja · Mar 11, 2018 · Viewed 11.9k times · Source

Problem Statement

I share URLs via Facebook and Whatsapp. These messaging apps tend to generate a "rich preview" in the form of a thumbnail for the link shared. Everything seems to work fine thus far

But if I change the content which my link points to then the next time I share the same link with a completely different person, the changes are not reflected! This applies to rich preview thumbnails in both Facebook and WhatsApp. The new person whom I messaged, still sees the old thumbnail that the previous user received from me.

For example, here is a snapshot of the thumbnail rendered by the messaging apps after a message with a link was sent by me to ALICE: Facebook thumbnail before editing content

And here is a snapshot of another thumbnail rendered by the messaging apps after I edited the content to which my link points. I changed the name to Pro3 and price to 549 and sent a new message to BOB ... but BOB sees the same thumbnail preview as ALICE! thumbnail after editing content

Not good solutions

  1. Changing the URL ever so slightly is not a solution that is a good fit for me.
  2. The scrape option on Facebook debugger would only work for that platform and it is not a good fit because it must be done manually, which means it cannot scale!

What I need help with

My preferred solution is to use Cache-Control and Pragma tags (as per web-standards) for disabling cache but it doesn't seem to work.

Here is my code

 '<title>' + metaData.title + '</title>' +
    '<meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate">\n' +
    '<meta http-equiv="Pragma" content="no-cache">\n' +
    '<meta http-equiv="Expires" content="0">\n' +
    '<meta http-equiv="refresh" content="0; url=http://my.site.com/my/products">' +
    '<meta name="description" content="' + metaData.description + '" />\n' +
    '<meta property="og:type" content="product" />\n' +
    '<meta property="og:title" content="' + metaData.title + '" />\n' +
    '<meta property="og:description" content="' + metaData.description + '" />\n' +
    '<meta property="og:image" content="' + metaData.imageUrl + '" />\n' +
    '<meta property="og:image:width" content="' + metaData.imgWidth + '"/>\n' +
    '<meta property="og:image:height" content="' + metaData.imgHeight + '" />\n' +
    '<meta property="og:image:alt" content="' + metaData.imgAlt + '"/>' +
    '<meta property="og:url" content="' + metaData.url + '" />\n' +
    '<meta name="og_site_name" property="og:site_name" content="' + metaData.domainName + '" />' +
    '<meta name="keywords" content="' + metaData.keywords + '">' +

Can someone please suggest another approach worth trying or help me fix whatever I might be doing wrong with the current approach?

Answer

A STEFANI picture A STEFANI · Mar 22, 2018

I expect this issue is relative to the Facebook and Whatsapp CDN...

Apparently on Facebook you may use the debugger tool and force Facebook to refresh the URL it has cached. (maybe use API to force the refresh), but I did not find this option on Whatsapp ...

The best solution is one of your "Not good solutions":

Changing the URL

which force implicitly the CDN to re-cache/update the new content.