Summary
After moving mattermost to a new domain name and new server (basically moving docker containers and updating the base url) link previews from before the migration still refers to the old url.
Eg, the HTML for a link preview in the previous instance would look like this:
<img class="attachment__image attachment__image--opengraph large_image" aria-label="miniature de fichier" tabindex="0" src="https://mattermost.olddomain.tld/api/v4/image?url=https%3A%2F%2Fmedia.newyorker.com%2Fphotos%2F5b17fc3416b67244b57c2a0a%2F16%3A9%2Fw_1200%2Ch_630%2Cc_limit%2F180618_r32233.jpg">
But in the new instance there’s en empty SVG tag instead:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1120 630" style="max-height: 630px; max-width: 1120px; vertical-align: middle;"></svg>
If I play around with the previous URL and replace the domain, like this:
<img class="attachment__image attachment__image--opengraph large_image" aria-label="miniature de fichier" tabindex="0" src="https://subdomain.newdomain.tld/mattermost/api/v4/image?url=https%3A%2F%2Fmedia.newyorker.com%2Fphotos%2F5b17fc3416b67244b57c2a0a%2F16%3A9%2Fw_1200%2Ch_630%2Cc_limit%2F180618_r32233.jpg">
Then the image is fetched and displayed.
I also have some recursive paths going on sometimes:
https://mattermost.olddomain.tld/mattermost/api/v4/image?url=https%3A%2F%2Fsubdomain.newdomain.tld%2Fmattermost%2Fapi%2Fv4%2Fimage%3Furl%3Dhttps%253A%252F%252Fimages.wsj.net%252Fim-20349%252Fsocial
Which leads to:
error fetching remote image: Get https://subdomain.newdomain.tld/mattermost/api/v4/image?url=https%3A%2F%2Fimages.wsj.net%2Fim-20349%2Fsocial#0x0: Get https://subdomain.newdomain.tld/mattermost/api/v4/image?url=https%3A%2F%2Fimages.wsj.net%2Fim-20349%2Fsocial: address forbidden, you may need to set AllowedUntrustedInternalConnections to allow an integration access to your internal network
Any ideas how I could restore link and picture preview in links posted before the migration ?
It also seems half of the link I post don’t generate a preview anymore but that might not be related. Looks like something is timing out ; also, even though both the old server and the new are running the same versions and databases and files the preview link layout is smaller in the new server.
It also doesn’t fetch/display the same OG info.
Thanks :).