# Images not loading - Possible HTTPS issue

**URL:** https://meta.discourse.org/t/images-not-loading-possible-https-issue/149398
**Category:** Support
**Created:** [April 27, 2020, 1:48am UTC](https://meta.discourse.org/t/images-not-loading-possible-https-issue/149398 "2020-04-27T01:48:16Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![spectrum](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/spectrum/32/142226_2.png) [@spectrum](https://meta.discourse.org/u/spectrum)
#### Post date: [April 27, 2020, 1:48am UTC](https://meta.discourse.org/t/images-not-loading-possible-https-issue/149398/1 "2020-04-27T01:48:16Z")

</div>

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.

> [@HTTPS support - Error Embedding](https://meta.discourse.org/t/https-support-error-embedding/68944/1):
>
> var discourseUrl = “https:// discussion.sitename.tld/”, discourseEmbedUrl = “\<?php print 'https:// sitename.tld/node/'.$node-\>nid; ?\>”; (function() { var d = document.createElement(‘script’); d.type = ‘text/javascript’; d.async = true; d.src = discourseUrl + ‘javascripts/embed.js’; (document.getElementsByTagName(‘head’)[0] || document.getElementsByTagName(‘body’)[0]).appendChild(d); })();

> [@HTTPS support - Error Embedding](https://meta.discourse.org/t/https-support-error-embedding/68944/5):
>
> I changed only the first link to HTTPS in the Discourse code block. Since this site is transitioning from HTTP to HTTPS, all previously created topics had a discourseEmbedUrl of **http://** sitename.tld/node/blablabla. Changing that to **https** made the topics appear to be recreated. So I ended up changing only the **discourseUrl** to HTTPS, and leaving the discourseEmbedUrl in HTTP to preserve previous topics.

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!

---

<div class="post-metadata">

### Author: ![Stephen](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/stephen/32/95011_2.png) [@Stephen](https://meta.discourse.org/u/Stephen)
#### Post date: [April 27, 2020, 1:51am UTC](https://meta.discourse.org/t/images-not-loading-possible-https-issue/149398/2 "2020-04-27T01:51:35Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![spectrum](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/spectrum/32/142226_2.png) [@spectrum](https://meta.discourse.org/u/spectrum)
#### Post date: [April 28, 2020, 12:17am UTC](https://meta.discourse.org/t/images-not-loading-possible-https-issue/149398/3 "2020-04-28T00:17:02Z")

</div>

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)?

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [June 15, 2024, 5:53am UTC](https://meta.discourse.org/t/images-not-loading-possible-https-issue/149398/4 "2024-06-15T05:53:20Z")

</div>



---

<div class="post-metadata">

### Author: ![JammyDodger](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jammydodger/32/254611_2.png) [@JammyDodger](https://meta.discourse.org/u/JammyDodger)
#### Post date: [June 15, 2024, 9:43am UTC](https://meta.discourse.org/t/images-not-loading-possible-https-issue/149398/5 "2024-06-15T09:43:56Z")

</div>


