# Where is %{base\_url} coming from?

**URL:** https://meta.discourse.org/t/where-is-base-url-coming-from/263073
**Category:** Self-hosting
**Tags:** unsupported-install, docker
**Created:** [April 27, 2023, 12:16pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073 "2023-04-27T12:16:28Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![di-rect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/di-rect/32/304372_2.png) [@di-rect](https://meta.discourse.org/u/di-rect)
#### Post date: [April 27, 2023, 12:16pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/1 "2023-04-27T12:16:28Z")

</div>

Hi All,

I’m running a Discourse container using the Bitnami image. The issue I experience there that all templates use [example.com](http://example.com) for the %{base\_url} variable and I don’t seem to be able to change this.

I created a support ticket at Bitnami but while searching I never can find anywhere on the internet anything about the base\_url variable.

[https://github.com/bitnami/containers/issues/31597](https://github.com/bitnami/containers/issues/31597)

Can anyone help me clearing this out ? I’m very confused about this variable.

---

<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: [April 27, 2023, 2:18pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/2 "2023-04-27T14:18:39Z")

</div>

We do not support installs using Bitnami images here. The recommendation is to install Discourse following the [standard install](https://meta.discourse.org/t/142537?silent=true) guide if you want support.

---

<div class="post-metadata">

### Author: ![di-rect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/di-rect/32/304372_2.png) [@di-rect](https://meta.discourse.org/u/di-rect)
#### Post date: [April 27, 2023, 3:19pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/3 "2023-04-27T15:19:24Z")

</div>

I understand but that is in the base not my question: Where does %{base\_url} come from or where is it based under ? I cannot even find that in the Discourse documentation or forum.

---

<div class="post-metadata">

### Author: ![di-rect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/di-rect/32/304372_2.png) [@di-rect](https://meta.discourse.org/u/di-rect)
#### Post date: [April 30, 2023, 8:23pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/4 "2023-04-30T20:23:11Z")

</div>

How do I change the %{base\_url} from [example.com](http://example.com) to my own domainname so my email-templates are parsed like they should ?

---

<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: [April 30, 2023, 8:54pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/5 "2023-04-30T20:54:28Z")

</div>

It sounds like something has gone wrong with your install if this isn’t being populated with the correct domain.

As has been mentioned, it may be easier for you to follow the [standard install](https://meta.discourse.org/t/142537?silent=true) and restore a backup if you’ve still not managed to track down what’s gone wrong.

---

<div class="post-metadata">

### Author: ![di-rect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/di-rect/32/304372_2.png) [@di-rect](https://meta.discourse.org/u/di-rect)
#### Post date: [April 30, 2023, 10:09pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/6 "2023-04-30T22:09:17Z")

</div>

Why is it beïng populated and not just set as a variable ?

---

<div class="post-metadata">

### Author: ![MichaIng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaing/32/251089_2.png) [@MichaIng](https://meta.discourse.org/u/MichaIng)
#### Post date: [May 1, 2023, 4:23am UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/7 "2023-05-01T04:23:41Z")

</div>

It seems you need to edit the Docker Compose YAML before pulling it: [containers/bitnami/discourse/docker-compose.yml at main · bitnami/containers · GitHub](https://github.com/bitnami/containers/blob/main/bitnami/discourse/docker-compose.yml#L31) (lines 31 and 51)

---

<div class="post-metadata">

### Author: ![di-rect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/di-rect/32/304372_2.png) [@di-rect](https://meta.discourse.org/u/di-rect)
#### Post date: [May 1, 2023, 7:43am UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/8 "2023-05-01T07:43:12Z")

</div>

I know, but changing it after the first run doesn’t fix it, so I wonder if it needs to be done from the first run as I like to know if it sets this host(name) staticly or not.

---

<div class="post-metadata">

### Author: ![MichaIng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaing/32/251089_2.png) [@MichaIng](https://meta.discourse.org/u/MichaIng)
#### Post date: [May 1, 2023, 5:14pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/9 "2023-05-01T17:14:58Z")

</div>

Is the Bitnami container also compiling Discourse completely new when updating it, like the official one?

The variable seems to be defined here:

> <https://github.com/discourse/discourse/blob/26b7f8a/lib/discourse.rb#L566>

The `current_hostname` variable is set here:

> <https://github.com/discourse/discourse/blob/26b7f8a/lib/discourse.rb#L533>

The `force_hostname` variable is declared in the site settings template here:

> <https://github.com/discourse/discourse/blob/e002a24/config/site_settings.yml#L2007>

As it is hidden, it cannot be changed in admin settings. As other site settings, I assume it would be stored in the database. I searched a database dump of our instance and `force_hostname` is not set or even declared. In our official discourse container YAML we have `DISCOURSE_HOSTNAME` assigned, but I guess this is a global setting, not a site setting, so this seems to be enforced differently.

`current_hostname` seems to be obtained from the current connecting, i.e. dynamic. But I cannot see where exactly it is defined, probably an external module/gem:

> <https://github.com/discourse/discourse/blob/6417173/lib/freedom_patches/rails_multisite.rb#L4>

I’m not sure what the Bitnami container does with the `DISCOURSE_HOST` setting, so at least you could search your database for `force_hostname` until we find out more about how `DISCOURSE_HOSTNAME` from official container is stored and enforced.

---

<div class="post-metadata">

### Author: ![di-rect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/di-rect/32/304372_2.png) [@di-rect](https://meta.discourse.org/u/di-rect)
#### Post date: [May 1, 2023, 9:43pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/10 "2023-05-01T21:43:46Z")

</div>

Thank you for your support so far! I was, comparing to you findings, also thinking about config my install as single multisite. This could maybe make it work, but it’s indeed a matter of trying to sort things out where I have the feeling that Bitnami doesn’t change anything on Discourse itself; so why this issue indeed.

I need to check my dump’s.

---

<div class="post-metadata">

### Author: ![di-rect](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/di-rect/32/304372_2.png) [@di-rect](https://meta.discourse.org/u/di-rect)
#### Post date: [May 2, 2023, 11:38pm UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/11 "2023-05-02T23:38:31Z")

</div>

> [@MichaIng](#):
>
> force\_hostname

Not able to find this in my Database Dumps.

---

<div class="post-metadata">

### Author: ![MichaIng](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/michaing/32/251089_2.png) [@MichaIng](https://meta.discourse.org/u/MichaIng)
#### Post date: [May 5, 2023, 11:20am UTC](https://meta.discourse.org/t/where-is-base-url-coming-from/263073/12 "2023-05-05T11:20:24Z")

</div>

Okay so currently I fail do understand where/how both Discourse container variants internally apply the hostname based on the container YAML.

Does the Bitnami container composition not include another webserver but expose the Discourse web port directly? The official containet has another Nginx in front of Discourse, something I actually wanted to get rid of if possible, as we have another Apache webserver outside of the container already.
