facebook-opengraphviber

Preview image in Viber


I've faced a problem with generating rich preview card in Viber. The idea is to show an image with annotation text for site's pages. Page snippet displays properly in all other messengers/social networks, but Viber can't handle my og:image. In attachment there are examples.

After some digging around I've find out that the problem is not about open graph markdown or image itself, but probably about image's response headers. I've tried to post in Viber chat direct link to the image itself (not the page). If it's stored on our common domain (or github, or whatever), preview card looks as expected. But if it's hosted on our subdomain for media files – there is no preview.

Links to reproduce:

https://www.rabota.ru/static/images/test/43285342.png - this will work

https://media.rabota.ru/og_image/vacancy/1/43285342.png - same image, will not

https://www.rabota.ru/vacancy/43285342/ – the page, where this image should be as preview cover

Also I've attached response headers for both cases

So the question is – why preview image presents in first case and does not in second, and if it's about headers – what headers should I modify? example

This works: enter image description here

This don't: enter image description here


Solution

  • As Viber support team mentioned content-length header is required for preview image