# Our domain name changed, where do I edit the hostname?

**URL:** <https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022>\
**Category:** Product Support\
**Created:** [December 11, 2018, 4:36pm UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022 "2018-12-11T16:36:57Z")\
**Posts on this page:** 9\
**Page:** 1

## AI-generated summary

The discussion revolves around changing the hostname in Discourse. [mholt](/t/-/104022/1) reported that users were experiencing issues with broken links and OAuth providers due to an outdated domain name. After searching, [mholt](/t/-/104022/2) discovered that the hostname is hard-coded in the `app.yml` file and had to rebuild the app to change it.

[codinghorror](/t/-/104022/3) confirmed that the hostname is stored in `app.yml` and rebuilding is necessary to change it. [jomaxro](/t/-/104022/4) provided a guide on changing the domain name and recommended running the remap command to fix internal links and uploads. [mholt](/t/-/104022/5) questioned why links and uploads are not hostname-relative, and [jomaxro](/t/-/104022/7) explained that uploads no longer use full URLs, but links do.

After running the remap command, [mholt](/t/-/104022/6) encountered an error, which [jomaxro](/t/-/104022/7) helped resolve by adding the scheme to the URL. [mholt](/t/-/104022/8) confirmed that this solution worked.

<div class="post-metadata">

**Author:** ![mholt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mholt/32/120935_2.png) [@mholt](https://meta.discourse.org/u/mholt)\
**Post date:** [December 11, 2018, 4:36pm UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/1 "2018-12-11T16:36:57Z")

</div>

Hi there – users are reporting that all links in emails are broken and they can’t login with any OAuth providers or reset passwords because Discourse is using a forum domain name that hasn’t been in use for about 2 years and doesn’t appear in the Discourse settings _anywhere_ (doing a search in the admin panel for all imaginable variants of the name and terms like “domain” or “host” or “address” or “URL” yield no relevant results).

The old domain appears to be a ghost in the shell. How can I force Discourse to use the actual name we’ve been using for about 2 years?

References:

- [Forum host name configuration - Site Feedback - Caddy Community](https://caddy.community/t/forum-host-name-configuration/4896)
- [caddy community password reset is broken · Issue #2386 · caddyserver/caddy · GitHub](https://github.com/mholt/caddy/issues/2386)

---

<div class="post-metadata">

**Author:** ![mholt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mholt/32/120935_2.png) [@mholt](https://meta.discourse.org/u/mholt)\
**Post date:** [December 11, 2018, 4:53pm UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/2 "2018-12-11T16:53:41Z")

</div>

Had to log in to the server and do a global `grep` for the hostname on the file system and found an instance in a file called `app.yml` in a folder `/var/discourse/containers`. Apparently the hostname of the forum is _hard-coded into the application_ instead of being configurable.

Edited the file, and it still didn’t work. Did some googling and ran `/var/discourse/launcher rebuild app` and after a few minutes of downtime it came back, and appears to be using the correct hostname now.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [December 12, 2018, 1:30am UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/3 "2018-12-12T01:30:35Z")

</div>

Yes, the hostname is stored in `app.yml` and you need to rebuild to change that.

---

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [December 13, 2018, 3:38am UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/4 "2018-12-13T03:38:06Z")

</div>

For future reference, check out our #howto at [Change the domain name or rename your Discourse](https://meta.discourse.org/t/change-the-domain-name-or-rename-my-discourse/16098). After the rebuild you’ll still want to run the remap (see end of linked guide), or things (like internal links and possibly uploads depending on your configuration) will be broken.

---

<div class="post-metadata">

**Author:** ![mholt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mholt/32/120935_2.png) [@mholt](https://meta.discourse.org/u/mholt)\
**Post date:** [December 13, 2018, 4:49am UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/5 "2018-12-13T04:49:23Z")

</div>

Incidentally, that does raise a question I’ve had through this process – why are links and uploads and other site-specific assets not hostname-relative? i.e. why spell out the full URL every time?

---

<div class="post-metadata">

**Author:** ![mholt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mholt/32/120935_2.png) [@mholt](https://meta.discourse.org/u/mholt)\
**Post date:** [December 13, 2018, 4:52am UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/6 "2018-12-13T04:52:17Z")

</div>

Oh, so remapping posts is good to know (that guide you linked to didn’t appear in my googling) – but in trying it, I get this error:

```plaintext
Error: ERROR: duplicate key value violates unique constraint "index_incoming_domains_on_name_and_https_and_port"
DETAIL: Key (name, https, port)=(caddy.community, t, 443) already exists.
The remap has only been partially applied due to the error above. Please re-run the script again.

```

Doing what it says and re-running the script again shows the same error.

---

<div class="post-metadata">

**Author:** ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)\
**Post date:** [December 13, 2018, 4:32pm UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/7 "2018-12-13T16:32:39Z")

</div>

To fix that error, try adding the scheme to the url. So if your remap command was  
`discourse remap talk.foo.com talk.bar.com`  
instead try  
`discourse remap https://talk.foo.com https://talk.bar.com`

> [@mholt](#):
>
> why are links and uploads and other site-specific assets not hostname-relative? i.e. why spell out the full URL every time?

Uploads no longer use the full URL, they’re something like `![116ae217fb1f57c4bd6058915c5db8abee9f0cd7|690x458](upload://2u570X7kQiPJQaJD1Bd8MLDHDNB.jpeg)`. Links do use the full domain as that’s how most people insert them into the composer, by pasting an absolute URL.

---

<div class="post-metadata">

**Author:** ![mholt](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mholt/32/120935_2.png) [@mholt](https://meta.discourse.org/u/mholt)\
**Post date:** [December 13, 2018, 9:38pm UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/8 "2018-12-13T21:38:15Z")

</div>

Thanks, that did the trick.

---

<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:** [January 12, 2019, 9:48pm UTC](https://meta.discourse.org/t/our-domain-name-changed-where-do-i-edit-the-hostname/104022/9 "2019-01-12T21:48:48Z")

</div>

Closed on January 12, 2019, 9:48pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
