Link previews does not work in some cases (Instagram)

Hi there, I’ve recently installed a Mattermost server, and all looks really fine, except this issue with link previews.

In general, link preview works, but when posting a link from instagram (could be any link, but for example Login • Instagram) there is no link preview generated.

Steps to reproduce
Just post a link, for example Login • Instagram

Expected behavior
A link preview with title, description, and image is generated.

Observed behavior
Just the link displayed, no link preview generated.

Some more details:

  • In general, link preview works, so if I paste a link from twitter, youtube, or some random page, a link preview (with image) and description is generated.
  • Website Link Previews in the Account Settings, and Enable Link Previews in the System Console is ON off course, no Disable link previews from these domains set, I also do not use image proxy
  • Server version: 5.38.2
  • Should not be related, but tried posting from web / MacOS / iOS client
  • Also tried to set the logging level to DEBUG but could not see any relevant log entry

I’m not even sure if it this feature supposed to work with Instagram, but usually it does in other chat applications, and I’ve tried that in another Mattermost chat (5.37.1 server) where I am only a user, and I had a link preview there (but without an image/thumbnail).

So I’m wondering if it’s an issue with my configuration, or something version related. I also tried to figure out what can go wrong by the post_metadata.go, but no luck so far.

Any tips would be appreciated.

If anybody has the same issue: Could not figure out what is wrong with my setup, some links works, some not, but I’ve learned that it’s not that easy to build those link previews even for sites which implements Open Graph protocol correctly.

I’ve ended up creating a custom bot which tries to read a linked pages’ open graph fields (and if not succeeded then trying to use some 3rd party linkreview / unfurling api) and returns with the preview.