Images not loading - Possible HTTPS issue

Hi there,
We’re experiencing an issue where relative-linked images, embedded in the fashion of <img src="/link/to/image.jpg" /> from Drupal, are not loading once they are posted as topics within Discourse. I think this is because they are being linked using HTTP from our discourseEmbedUrl variable; but our server delivers all content over HTTPS, which results in a broken image. This is fixed when the link is modified within Developer Tools, for example, to change the link from HTTP to HTTPS.

Tl;dr version: Is it possible to have Discourse use the discourseUrl variable for embedding images, instead of discourseEmbedUrl?
Longer explanation below describes how we arrived at this configuration, and provides more details:

In short, all topics up until our HTTPS switchover were created using HTTP links as the topic source. So when we switched over, we needed the discourseEmbedUrl variable to continue using HTTP links, otherwise duplicate HTTPS articles were created using the new HTTPS topic source URL.

Sorry for the long explanation; is it possible to have embedded images use a different variable than the source URL for cases like this? It seems like we’re currently stuck with two options:

  • Use the same discourseEmbedUrl variable (HTTP) for images as we use for the topic source URL, which results in broken images (as they appear to not be delivered properly over HTTP within embeds)

  • Change the discourseEmbedUrl variable to be HTTPS, and have working images, but also have a duplicate topic created whenever a visitor executes the embed code (as a result of using a different discourseEmbedUrl than its counterpart topic source URL)

I can provide additional information if needed – please let me know!

1 Like

I think you need to correct those topic URLs, assuming both sites are now HTTPS you don’t want any data referring back to insecure objects.


Is there a way to mass-change all HTTP links to be HTTPS? We have over 8,000 articles… probably not all have matching topics, but still - it would be a huge undertaking unless there’s a way to automate the effort.

The topic URLs successfully redirect visitors to the correct page because of how the server is set up, though – so they are currently working well. The only issue we’re running into is this image problem.

Is there a way I could configure this to not use discourseEmbedUrl for images, but rather, use discourseUrl instead (or some other variable I can set to the HTTPS link)?