# Issue Onebox in HTTPS

**URL:** <https://meta.discourse.org/t/issue-onebox-in-https/57904>\
**Category:** Self-hosting\
**Created:** [February 24, 2017, 3:45pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904 "2017-02-24T15:45:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)\
**Post date:** [February 24, 2017, 3:45pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/1 "2017-02-24T15:45:24Z")

</div>

We set Nginx has a front-end proxy for discourse docker (with sock [Add an offline page to display when Discourse is rebuilding or starting up](https://meta.discourse.org/t/adding-an-offline-page-when-rebuilding/45238)).  
Then we set HTTPS Lets’ Encrypt **outside the container** (acme.sh) and everything works fine except onebox for internal link.  
Onebox is not able to show the preview of internal links. They are as external links

- HTTPS link

 ![](https://global.discourse-cdn.com/meta/original/4X/f/6/7/f675b408c03169d48d08569a1743e21558304a5e.png)

- Same link in HTTP:

 ![](https://global.discourse-cdn.com/meta/original/4X/9/6/d/96d058405e069b94124c7648581e964c4c26deaa.png)

Is there a way to fix this issue?

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 24, 2017, 3:49pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/2 "2017-02-24T15:49:43Z")

</div>

Is `force_ssl` checked on site settings?

Obligatory, please share a link to the forum in a support topic.

---

<div class="post-metadata">

**Author:** ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)\
**Post date:** [February 24, 2017, 4:00pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/3 "2017-02-24T16:00:05Z")

</div>

> [@Falco](#):
>
> Is force\_ssl checked on site settings?

Do you meen `force_https` on the admin panel? I can’t find `force_ssl` on site settings.

> **[AduForum](https://forum.adunanza.net)**
>
> Il network P2P ad alte prestazioni

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 24, 2017, 4:02pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/4 "2017-02-24T16:02:19Z")

</div>

> [@Trash](#):
>
> Do you meen force\_https on the admin panel?

Yes, and looks like you don’t.

Also, when checking this, if you reverse proxy is badly configured, it’s gonna break your site.

---

<div class="post-metadata">

**Author:** ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)\
**Post date:** [February 24, 2017, 4:08pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/5 "2017-02-24T16:08:48Z")

</div>

> [@Falco](#):
>
> Also, when checking this, if you reverse proxy is badly configured, it’s gonna break your site.

Just made a backup, we will try to check the “force\_https” setting. Do you confirm that even if discourse runs through sock, and so the “ssl template” is commented out, everything should work fine?  
Our reverse proxy is configured to redirect all http traffic to https.

---

<div class="post-metadata">

**Author:** ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)\
**Post date:** [February 24, 2017, 4:13pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/6 "2017-02-24T16:13:09Z")

</div>

> [@Trash](#):
>
> Do you confirm that even if discourse runs through sock, and so the “ssl template” is commented out, everything should work fine?

I’m not really a fan of running reverse proxy in self-hosted environments, unless you are very comfortable with your reverse proxy of choice.

That said, if you have all the correct headers set, it will work.

---

<div class="post-metadata">

**Author:** ![dax](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dax/32/244677_2.png) [@dax](https://meta.discourse.org/u/dax)\
**Post date:** [February 24, 2017, 4:24pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/7 "2017-02-24T16:24:17Z")

</div>

It works perfectly now.  
Thanks for the support @Falco.

---

<div class="post-metadata">

**Author:** ![tophee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/tophee/32/73406_2.png) [@tophee](https://meta.discourse.org/u/tophee)\
**Post date:** [May 18, 2017, 11:43pm UTC](https://meta.discourse.org/t/issue-onebox-in-https/57904/9 "2017-05-18T23:43:18Z")

</div>

> [@Falco](#):
>
> That said, if you have all the correct headers set, it will work.

Which headers would that be?

Here’s what I have:

```
location / {
            proxy_pass http://unix:/var/discourse/shared/standalone/nginx.http.sock;
            proxy_set_header Host $http_host;                                                                                                     
            proxy_http_version 1.1;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header X-Forwarded-Proto $scheme;                                                                                           
            client_max_body_size 20M;
            error_page 502 =502 /errorpages/offline.html;
            proxy_intercept_errors on;
            error_page 500 503 504 /errorpages/50x.html;
}

```

---

<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/issue-onebox-in-https/57904/10 "2024-06-08T12:44:44Z")

</div>

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