Image Previews Broken

Summary

All image previews stopped showing up on my Mattermost a few months ago, trying to figure out how to get them back. They are gone across all browsers (Edge, Safari, Firefox, Chrome). No one at my org uses the desktop app so we don’t care about that.

Steps to reproduce

I have a Gitlab omnibus Mattermost (last updated Jan 29th 2021) running on Ubuntu 16.04:
Mattermost Version: 5.30.6{PATCH}
Database Schema Version: 5.30.0
Database: postgres

There are 0 logs generated when posting an image, so no errors that I can see.
Relevent settings:

  • “Enable Link Previews” is set to true
  • Image proxy is off (I’ve tried turning it on, doesn’t make a difference)
  • “Link Metadata Timeout” is set to 10,000ms (10 seconds). I upped it from the default, it did not change anything.
  • Mattermost server has company proxy settings set in the /etc/gitlab/gitlab.rb file (urls anonymized):
    mattermost['env'] = {"http_proxy" => "http://proxy.company.com:80", "https_proxy" => "http://proxy.company.com:80", "no_proxy" => "localhost,127.0.0.1,.company.com"}
    (these proxy settings have been in place for years and worked fine)

Expected behavior

A preview of the image

Observed behavior

No preview is made, it doesn’t even give any indication it’s trying to load one.

I’ve read the issue here: Probleme with gif and preview youtube video · Issue #11291 · mattermost/mattermost-server · GitHub
But nothing in there helped me.
Looking for any ideas I may have missed.

I am back with THE SOLUTION (for me, anyway):

I needed to add the proxy to a variable called MM_SERVICESETTINGS_ALLOWEDUNTRUSTEDINTERNALCONNECTIONS in the environment:

mattermost['env'] = {"http_proxy" => "http://proxy.company.com:80", 
"https_proxy" => "http://proxy.company.com:80", 
"no_proxy" => "localhost,127.0.0.1,.company.com"
"MM_SERVICESETTINGS_ALLOWEDUNTRUSTEDINTERNALCONNECTIONS" => "localhost 127.0.0.1 proxy.company.com"}

If you just run Mattermost without Gitlab, the equivalent variable is AllowedUntrustedInternalConnections in config.json. If you are using the bundled version you CANNOT use that config file - Gitlab will override it with the environment variable always, because it makes sure it includes at least localhost.

1 Like