# Got mix-content error and confused

**URL:** https://meta.discourse.org/t/got-mix-content-error-and-confused/66523
**Category:** WordPress
**Created:** [July 20, 2017, 3:58pm UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523 "2017-07-20T15:58:16Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [July 20, 2017, 3:58pm UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/1 "2017-07-20T15:58:16Z")

</div>

After enabling WP-Discourse plugin, I found comments from Discourse caused my WP site mix-content problem: All the avatars were loaded through HTTP instead of HTTPS.

I tried to fix it myself. And after reading the WP-discourse plugin code, I found the HTTP image URLs are stored in wp\_postmeta with meta\_key `discourse_comments_raw`. And this value is got from [https://my.discourse.site/t/topic/20/wordpress.json](https://my.discourse.site/t/topic/20/wordpress.json)

I found this JSON file responded with HTTP images URLs instead of HTTPS. But my whole Discourse site is transferred through HTTPS.(Though I noticed that it also sometimes get mix-content problem too)

The possible reason for this is that I used HTTP from the very beginning and later changed to HTTPS and some settings seems not changed…

Can anybody tell me how to fix this?

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [July 20, 2017, 4:32pm UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/2 "2017-07-20T16:32:18Z")

</div>

By the way, I add SSL by assigning certification to outer Nginx. Guess I have to specify using HTTPS in settings somewhere…

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 20, 2017, 4:44pm UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/3 "2017-07-20T16:44:10Z")

</div>

> [@Vencent](#):
>
> I found this JSON file responded with HTTP images URLs instead of HTTPS. But my whole Discourse site is transferred through HTTPS.(Though I noticed that it also sometimes get mix-content problem too)

It seems that the image URLs returned from your Discourse forum are http. I’ll see if there’s anything that can be done on the WordPress end to deal with that.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [July 21, 2017, 2:05am UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/4 "2017-07-21T02:05:27Z")

</div>

The problem fixed after I enabling force HTTPS in Discourse. Add an option on the WordPress end will be good though.

BTW, even if my post published to Discourse only has a link (followed instruction on [Customize the structure of WP Discourse templates](https://meta.discourse.org/t/wp-discourse-template-customization/50754)). There is still a “show full post” button under the Onebox. And if I click it the link will expand to a full article in plain text. This is not good. I’m a freshman to Discourse. Is this how Discourse treat external links?

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 21, 2017, 2:14am UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/5 "2017-07-21T02:14:21Z")

</div>

> [@Vencent](#):
>
> There is still a “show full post” button under the Onebox

You can remove this on Discourse by unselecting the ‘embed truncate’ setting. There is a description of how to do this in the [WP Discourse](https://github.com/discourse/wp-discourse) inline documentation. It’s found on the Publishing tab in the description for the Use Full Post Content setting.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [July 21, 2017, 2:38am UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/6 "2017-07-21T02:38:04Z")

</div>

I do see that documentation.

But I unselected “Publish the full post to Discourse, rather than an excerpt.” in WP-Discourse settings. So I think since WP-Discourse won’t publish the full post to Discourse, Discourse has no full post to show. However the actual result is not like what I think.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 21, 2017, 2:44am UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/7 "2017-07-21T02:44:00Z")

</div>

Sorry, I was not being clear. That setting will not have an effect on your posts, because you are using a custom template. But, the description of that setting tells you what you need to do to remove the ‘Show Full Post’ button from Discourse.

Go to your Discourse forum at `/admin/site_settings/category/posting` and look for the ‘embed truncate’ setting. Unselect that setting on Discourse.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [July 21, 2017, 5:17am UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/8 "2017-07-21T05:17:53Z")

</div>

That’s fine I got your point.

Another thing I don’t understand is: since there is an `link account` option in user profile page (when Discourse is used as the SSO provider), why user can still edit their Discourse username on that page? Won’t that cause problems?(For example change it to administrator’s username)

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 21, 2017, 5:26am UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/9 "2017-07-21T05:26:26Z")

</div>

> [@Vencent](#):
>
> why user can still edit their Discourse username on that page?

If you select the option ‘Do Not Display Discourse Name Field’ on the Publishing tab, the Discourse Username won’t be editable. Unfortunately with that setting, the Discourse Username is not displayed at all. That’s something that needs to be fixed.

---

<div class="post-metadata">

### Author: ![Vencent](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vencent/32/120037_2.png) [@Vencent](https://meta.discourse.org/u/Vencent)
#### Post date: [July 21, 2017, 7:42am UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/10 "2017-07-21T07:42:00Z")

</div>

Well that’s really a weird design. Hope to be fixed. I’ll see if I can fix it myself later.

---

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [July 21, 2017, 2:31pm UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/11 "2017-07-21T14:31:07Z")

</div>

What I was thinking of doing is just printing the Discourse username to the user preferences page so that it could be seen that it’s set. Would that work?

---

<div class="post-metadata">

### Author: ![mr8](https://avatars.discourse-cdn.com/v4/letter/m/f9ae1b/32.png) [@mr8](https://meta.discourse.org/u/mr8)
#### Post date: [July 21, 2017, 7:18pm UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/12 "2017-07-21T19:18:36Z")

</div>

> [@Vencent](#):
>
> By the way, I add SSL by assigning certification to outer Nginx. Guess I have to specify using HTTPS in settings somewhere…

I had a similar problem: [Insecure content from markdown-it-bundle when using https](https://meta.discourse.org/t/insecure-content-from-markdown-it-bundle-when-using-https/66559)

You need to let discourse know you want the SSL version of the site by specifying https in your outer nginx config by adding:

```
proxy_set_header Host $http_host;

```

or

```
proxy_set_header Host https

```

Then just reload nginx and it should work correctly!  
Hope this helps!

---

<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 8, 2024, 12:44pm UTC](https://meta.discourse.org/t/got-mix-content-error-and-confused/66523/13 "2024-06-08T12:44:30Z")

</div>

This topic was automatically closed after 2514 days. New replies are no longer allowed.
