Images on AWS missing from body of emails on iOS Mail app

AI-generated summary

User Richie reports an issue where images hosted on AWS are missing from email notifications when viewed in the iOS Mail app. The images display correctly when viewed in Gmail on Firefox. Richie suspects it may be an iOS-specific issue.

Rchie and chumstick discuss a possible connection to a known bug related to digest logos, but Richie notes that the issue persists despite running Discourse v2.2.2.beta6+5, which fixed the digest logo bug.

Rchie observes that images in daily summary emails appear correctly, but single notification emails with images do not. Richie confirms that the issue only occurs when using the built-in Mail app on iOS.

Rchie hypothesizes that the issue is due to the missing https: in the image URL. Stephen asks if the site has force_https enabled, and Richie confirms it has been enabled since day one.

Sam and Richie discuss the possibility of using a CDN, but Richie notes that no CDN is currently in use.

Neil suggests that the issue might be due to iPhone Mail not liking <img src="//somewhere.com/image.png">. Richie proposes a simple solution to add https: to the image URL if it is missing.

Sam recommends changing all CDN URLs to https:// and rebaking everything, but Richie notes that no CDN is in use. Sam suggests setting the CDN URL to the S3 base URL and adding https: there.

Hi everyone,

Not sure if this is a bug or a configuration issue. However, I’m quite sure this has only happened recently, I’m sure I’d have noticed before now otherwise :blush:

All our images are hosted on AWS.

We are running Discourse v2.2.2.beta6+5

When an email notification arrives that contains an embedded image on Amazon AWS, the image itself is missing / not displaying.

This issue may be of a similar theme / issue to Missing logo in email summary ? (Which we also suffered with, and was subsequently fixed, thanks!)

Here’s a screen shot of how the email(s) look when viewed in the Mail app on iOS devices:

The image links to //greyarrows.s3.dualstack.eu-west-2.amazonaws.com/original/2X/3/37430494c198530c000587d93a8fd05ebfdd97f3.jpeg

If I put https: in front of the link and open it in a new private browser window, the image does seem to load ok: https://greyarrows.s3.dualstack.eu-west-2.amazonaws.com/original/2X/3/37430494c198530c000587d93a8fd05ebfdd97f3.jpeg

Is this a bug? Or have I possibly missed some kind of config setting on AWS and simply not noticed this issue before? :thinking:

Although, when viewed in Gmail on Firefox on my desktop PC, the image appears perfectly:

Which makes me think this may just be an iOS thing…? :thinking:

Although here’s an older email that does display the image:

So I’m not sure now…

Seemed to work in emails I received in October, but sadly I don’t subscribe to many threads for email notifications.

Anyone else experienced this issue?

It’s a known bug of the digest logo. Looks nearly identical in cause though, the malformed URLs when hosted in S3.

Per the linked topic, this bug was fixed though, so patch to latest if you haven’t already.

Hi @chumstick and @codinghorror

As per my first post, I’m already running Discourse v2.2.2.beta6+5 which did indeed fix the digest logo bug :+1:t2:

@chumstick is the same problem that caused the logo issue recently also affecting S3 images in the body of the email too?

Here’s one from yesterday that also doesnt display the image:

The link that’s presented doesn’t include https: at the start, will this be an issue?

Another observation, images in the daily summary emails do actually appear :thinking:

Are emails with single notifications + an image handled differently somehow?

Just wondering if anybody has any suggestions on a fix or work around for images in posts not appearing within the email notifications?

To confirm, it only occurs when using the built in / default Mail app on iOS. This issue presents itself on iOS 10 and iOS 12 (I don’t have an 11 device).

All of our notification emails that reference images uploaded to our AWS still fail to display when viewed using the Mail app built in to iOS.

The daily summary emails display the images fine - which I don’t understand. They must be embedded or referenced differently somehow.

Here’s what all iOS users see:

As a test, I’d like to add https: to the start of the image src url as I think this may solve the problem:

Does anyone know how I could do that? :thinking:

Would adding https: to the img src url cause issues elsewhere?

I think my theory of the https: missing from the image URL may be correct.

I received an email notification from meta today, and it included an image:

As you can see, that image displayed perfectly in the iOS mail app.

Looking at the URL of the image itself, it DOES include https: at the start:

I realise that the image in that email is hosted on fastly rather than AWS, but why does meta put https in the image URL and my instance does not?

:thinking:

Does your site have force_https enabled?

I wonder @codinghorror if we should default force https in production now, it pops up enough, and non https sites should be a rarity

There are lots of situations where Let’s Encrypt can fail, but if enrolment succeeds in a standard install I would be all for it.

We can detect if 443 is exposed, the SSL/LE templates are in place and the certbot result, right?

Hi @Stephen - yes, it’s been on from day one:

Curious as to why meta puts https in the image url of the email notifications and my discourse (v2.3.0.beta3) does not? :thinking:

Are you using a CDN? If so what is your CDN URL?

Hi @sam there is no CDN in use on my instance:

I’m seeing this issue in the daily summary emails sometimes too:

And again, when looking at the URL of the image there is no https: in there either:

I still don’t know if this is the cause and until I can find a way to add https: to the image url I don’t know how else to rule this out.

hmmm maybe the codepath the omits images from ultra short emails is accidentally being triggered for digests, is that possible @neil?