# Make auto-linked URLs use HTTPS

**URL:** https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690
**Category:** Support
**Created:** [November 16, 2023, 8:53am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690 "2023-11-16T08:53:14Z")
**Posts on this page:** 18
**Page:** 1

<div class="post-metadata">

### Author: ![renem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renem/32/117354_2.png) [@renem](https://meta.discourse.org/u/renem)
#### Post date: [November 16, 2023, 8:53am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/1 "2023-11-16T08:53:14Z")

</div>

I tried googling or searching but couldn’t find it. When I type a domain name such as [discourse.org](http://discourse.org) in a sentence, this becomes a link. This is a HTTP link:

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/a/0/2a085e0917fb2c08a4c7de783ef32bf055708a93.png)

Is there any way to make this HTTPS by default? I’m trying to get rid of mixed content errors without manually turning these into HTTP links.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 16, 2023, 10:51am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/2 "2023-11-16T10:51:36Z")

</div>

There is a force\_https site setting. It’s enabled by default on a [standard install](https://meta.discourse.org/t/142537?silent=true).

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [November 16, 2023, 11:13am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/3 "2023-11-16T11:13:36Z")

</div>

Is it not enabled here then? Even the direct link to [meta.discourse.org](http://meta.discourse.org) is an HTTP link here. I will verify if this is true on other forums.

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [November 16, 2023, 11:30am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/4 "2023-11-16T11:30:42Z")

</div>

From what I see in the code, `force_https` is false by default.

> <https://github.com/discourse/discourse/blob/main/config/site_settings.yml#L1760-L1761>

---

<div class="post-metadata">

### Author: ![renem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renem/32/117354_2.png) [@renem](https://meta.discourse.org/u/renem)
#### Post date: [November 16, 2023, 11:33am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/5 "2023-11-16T11:33:46Z")

</div>

The force\_https site setting is missing here. From what I read here:

> [@Set up HTTPS support with Let's Encrypt](https://meta.discourse.org/t/set-up-https-support-with-lets-encrypt/40709):
>
> bookmark This is a guide for enabling HTTPS on an existing Discourse installation using Let’s Encrypt. It assumes prior installation without HTTPS enabled. person_raising_hand Required user level: System Administrator exclamation This guide is only for existing installs where HTTPS is not enabled. Following the [official setup guide](https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md) automatically enables HTTPS by default. So you’d like to add https to your Discourse absolutely free, courtesy of our friends at [Let’s Encrypt?](https://letsencrypt.org/)bell I…

This happens because HTTPS is enabled. I use Let’s encrypt.

It seems that by default, text links are HTTP and you can’t change this. If you add it on a new line, it becomes a HTTPS link. For example:

> **[Where Tech Companies Build Communities](https://discourse.org)**
>
> The customizable, scalable community platform powering over 22,000 communities. Create knowledge through conversation.

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [November 16, 2023, 11:34am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/6 "2023-11-16T11:34:17Z")

</div>

Just confirmed, links posted like this use **http** , _even_ when `force-https` is _ **on** _.

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [November 16, 2023, 11:35am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/7 "2023-11-16T11:35:28Z")

</div>

> [@renem](#):
>
> If you add it on a new line, it becomes a HTTPS link

I could be wrong, but I assume that’d be because the oneboxer follows all redirects when placed like that, where it doesn’t for on-line links.

---

<div class="post-metadata">

### Author: ![renem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renem/32/117354_2.png) [@renem](https://meta.discourse.org/u/renem)
#### Post date: [November 16, 2023, 11:41am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/8 "2023-11-16T11:41:45Z")

</div>

So, the big question is…can we change this behavior? HTTPS is pretty much the default nowadays:

> **[Usage Statistics of Default protocol https for Websites, June 2026](https://w3techs.com/technologies/details/ce-httpsdefault#:~:text=Default%20protocol%20https%20is%20used,of%20all%20the%20websites)**
>
> How many websites are using Default protocol https

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [November 16, 2023, 11:42am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/9 "2023-11-16T11:42:05Z")

</div>

The [discourse.org](http://discourse.org) or [meta.discourse.org](http://meta.discourse.org) are watched words replaced automatically by links. Maybe it doesn’t use https links there. 🤔

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [November 16, 2023, 11:42am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/10 "2023-11-16T11:42:52Z")

</div>

I don’t believe that is true, the same behavior is exhibited on, say, [google.com](http://google.com) and [apple.com](http://apple.com) for a few quick examples.

To me, it seems like inline links without a protocol just default back to `http`. (so [https://google.com](https://google.com) works for example)

---

<div class="post-metadata">

### Author: ![Arkshine](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/arkshine/32/298682_2.png) [@Arkshine](https://meta.discourse.org/u/Arkshine)
#### Post date: [November 16, 2023, 11:43am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/11 "2023-11-16T11:43:40Z")

</div>

Oh, you’re right. 🤔

---

<div class="post-metadata">

### Author: ![renem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renem/32/117354_2.png) [@renem](https://meta.discourse.org/u/renem)
#### Post date: [November 16, 2023, 11:56am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/12 "2023-11-16T11:56:24Z")

</div>

Exactly. It would make sense to change this behavior to HTTPS instead of HTTP right?

---

<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: [November 16, 2023, 12:20pm UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/13 "2023-11-16T12:20:49Z")

</div>

> [@renem](#):
>
> I’m trying to get rid of mixed content errors

Unless something has changed recently a link to an insecure site won’t trigger a mixed content error.

Mixed content errors refer to the assets which make up the page. If your site is https but loads assets from an insecure source then you would be serving mixed content.

`Force_https` refers to your discourse site and internal links within it.

> [@renem](#):
>
> It seems that by default, text links are HTTP and you can’t change this. If you add it on a new line, it becomes a HTTPS link. For example:

A link on a new line oneboxes, rather than just being a link. To do that the link has to be ”loaded” and the default document at the destination is inspected. If the site uses https over http that redirect would take place.

---

<div class="post-metadata">

### Author: ![Bas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bas/32/294929_2.png) [@Bas](https://meta.discourse.org/u/Bas)
#### Post date: [November 16, 2023, 12:52pm UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/14 "2023-11-16T12:52:05Z")

</div>

> [@renem](#):
>
> can we change this behavior?

I don’t think you would want this.

> [@renem](#):
>
> HTTPS is pretty much the default nowadays:

While it’s certainly high, which is good, I don’t think that 85% is enough to change the default behaviour of your forum.

As far as I know, pretty much any (I’d bet on 99+%) https site will redirect all http requests to the https one.

The reverse does not hold true.

Meaning that linking to [http://example.com](http://example.com) is almost never a problem, since you end up on [https://example.com](https://example.com) anyway.

* * *

Like @Stephen , I think you might be focussing on the wrong part. As far as I know, having a `<a href="http...` link will not trigger the mixed content warnings.

This error should only be triggered by embedding non-https content into your https site. So loading external images could be a culprit, or embedding a third party script, something in a theme maybe?  
Probably good to dive deeper into the browser console and see what triggers the error 🙂

---

<div class="post-metadata">

### Author: ![renem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renem/32/117354_2.png) [@renem](https://meta.discourse.org/u/renem)
#### Post date: [November 17, 2023, 9:25am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/15 "2023-11-17T09:25:18Z")

</div>

> [@Bas](#):
>
> I don’t think you would want this.

Let me explain. We have many users who type in our domain name in forum replies. We also embed forum replies on the main site so now I have some HTTP internal links instead of HTTPS. It’s not a big issue, but if I could make these HTTPS as well, that would be nice.

> [@Bas](#):
>
> Like @Stephen , I think you might be focussing on the wrong part. As far as I know, having a `<a href="http...` link will not trigger the mixed content warnings.

This is correct, it doesn’t trigger a mixed content warning 🙂

Is there anything I can do? Besides monitoring replies and perhaps writing a script to update URLS 🙂

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [November 18, 2023, 12:01am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/16 "2023-11-18T00:01:36Z")

</div>

I think you can use watched words to replace the bare hostname with the url

---

<div class="post-metadata">

### Author: ![renem](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renem/32/117354_2.png) [@renem](https://meta.discourse.org/u/renem)
#### Post date: [November 20, 2023, 8:16am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/17 "2023-11-20T08:16:38Z")

</div>

I didn’t realize this was possible but it sounds like a good idea. I’ll give it a try. In case anyone else is looking for this:

…/admin/customize/watched\_words/action/replace

---

<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: [November 20, 2023, 8:27am UTC](https://meta.discourse.org/t/make-auto-linked-urls-use-https/285690/18 "2023-11-20T08:27:41Z")

</div>

I think these two features may not be compatible. If I remember right, the `markdown linkify tlds` seems to take precedence and won’t allow the link to be swopped out by the watched words replace.
