# (Superseded) Redirect additional domain(s) to your Discourse instance

**URL:** https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492
**Category:** Self-Hosting
**Tags:** how-to
**Created:** [8월 5, 2014, 10:46오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492 "2014-08-05T10:46:41Z")
**Posts on this page:** 20
**Page:** 2

<div class="post-metadata">

### Author: ![vodwood](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/vodwood/32/37517_2.png) [@vodwood](https://meta.discourse.org/u/vodwood)
#### Post date: [11월 20, 2014, 11:32오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/27 "2014-11-20T11:32:26Z")

</div>

Thanks! Done it the way you suggested. All I have left now is to wait 48 hours to see if this actually works.  
The weird thing is that AWS (which I use to manage my hosted zones) usually takes just around an hour to make it all work with their own instances (and some dedicated servers from other providers). In this case (DO), I had to redeploy discourse 2 times thinking there was smthn wrong with the configuration (the dns record for the previous deploy failed to resolve after 14 or so hours). Fingers crossed.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [11월 21, 2014, 2:40오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/28 "2014-11-21T02:40:48Z")

</div>

That’s a consequence of your DNS TTL, not anything with the provider. Unless you chose to use Digital Ocean as your DNS provider.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [11월 26, 2014, 9:32오후 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/29 "2014-11-26T21:32:23Z")

</div>

> [@techAPJ](#):
>
> server\_names\_hash\_bucket\_size 64;

What is up with this? Why is it required?

* * *

EDIT

it is required cause the rule will not work without it… just confirmed

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [11월 27, 2014, 2:45오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/30 "2014-11-27T02:45:19Z")

</div>

From [nginx.org](http://nginx.org/en/docs/http/server_names.html):

> If a large number of server names are defined, or unusually long server names are defined, tuning the `server_names_hash_max_size` and `server_names_hash_bucket_size` directives at the `http` level may become necessary.

In my testing, the server/domain name was `discourse.arpitjalan.com`, so increasing the `server_names_hash_bucket_size` to 64 was required.

---

<div class="post-metadata">

### Author: ![rahim123](https://avatars.discourse-cdn.com/v4/letter/r/df705f/32.png) [@rahim123](https://meta.discourse.org/u/rahim123)
#### Post date: [12월 10, 2014, 2:11오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/31 "2014-12-10T02:11:05Z")

</div>

Does `DISCOURSE_HOSTNAME` work with multiple domains, if I want either one of the domains to work without redirection? As in:  
`DISCOURSE_HOSTNAME: 'example1.com,example2.com'` ?

---

<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: [12월 10, 2014, 2:35오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/32 "2014-12-10T02:35:37Z")

</div>

No, why would it? You would create cookies at different domains (logged in at `foo.com` but not `bar.com`) and you would be subject to serious duplicate content penalties from Google.

---

<div class="post-metadata">

### Author: ![SMT](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SMT](https://meta.discourse.org/u/SMT)
#### Post date: [3월 21, 2015, 2:21오후 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/33 "2015-03-21T14:21:37Z")

</div>

Hello getting the below error. My forum is offline pls check

```
(<unknown>): did not find expected key while parsing a block mapping at line 81 column 7 -ANG=en_US.UTF-8

```

YAML syntax error. Please check your /var/discourse/containers/\*.yml config files.

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [3월 21, 2015, 5:07오후 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/34 "2015-03-21T17:07:02Z")

</div>

Run your app.yml file through an online YAML validator.

---

<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: [3월 21, 2015, 9:35오후 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/35 "2015-03-21T21:35:21Z")

</div>

Is there any way we could make a command line YAML validator part of our Docker image and validate the YAML before we build? Cc: @sam

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [3월 21, 2015, 11:47오후 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/36 "2015-03-21T23:47:47Z")

</div>

I think if we wrote a short Go program, it could get statically compiled and shipped in `discourse_docker`. (Source in the repo, of course.) Would be much, much easier than trying to validate it in bash…

---

<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: [3월 22, 2015, 2:26오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/37 "2015-03-22T02:26:28Z")

</div>

It should be a Ruby program. I don’t see why we can’t ship a basic version of Ruby in the container. We need to normalize on standard code, unless there is some mission critical, absolute reason it can’t be in Ruby.

(Or Node or io.js or whatever, isn’t that already in our container @sam?)

---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [3월 22, 2015, 4:09오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/38 "2015-03-22T04:09:10Z")

</div>

> [@codinghorror](#):
>
> Ruby **in** the container

I thought that the whole point was that this _isn’t_ in the container. If it was, we could just pull in Discourse’s yaml parser and use that.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [3월 22, 2015, 4:14오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/39 "2015-03-22T04:14:20Z")

</div>

./launcher invokes ruby quite a few times, so yeah we can run a validator … but what I really want is to add support to toml or some other less crazy format into pups so container defs can be in a non space sensitive format (optionally)

---

<div class="post-metadata">

### Author: ![SMT](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SMT](https://meta.discourse.org/u/SMT)
#### Post date: [3월 23, 2015, 5:16오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/40 "2015-03-23T05:16:45Z")

</div>

Here is the error i get when I run the query ./launcher rebuild app

```
(<unknown>): did not find expected key while parsing a block mapping at line 16 column 1 -e LANG=en_US.UTF-8
YAML syntax error. Please check your /var/discourse/containers/*.yml config files.

```

And If I post the same code on YAML vailidator It shows the following error.

```
syntax error on line 51, col 2: ` DISCOURSE_SMTP_ADDRESS: 'smtp.mandrillapp.com' #(mandatory)
'

```

---

<div class="post-metadata">

### Author: ![SMT](https://avatars.discourse-cdn.com/v4/letter/s/dec6dc/32.png) [@SMT](https://meta.discourse.org/u/SMT)
#### Post date: [3월 23, 2015, 6:10오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/41 "2015-03-23T06:10:51Z")

</div>

Somehow, I managed to solve the errors. Problem fixed. My forum is up now. Thank you.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [3월 23, 2015, 2:38오후 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/42 "2015-03-23T14:38:05Z")

</div>

I agree the better solution is to not use a format that is so easily mangled into “blow up with an exception” land. Toml does seem pretty good so far.

However in the meantime it might be easier to just throw in a validation step.

---

<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: [3월 24, 2015, 3:06오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/43 "2015-03-24T03:06:19Z")

</div>

Yeah this is going to take a while and @sam we should support either format as the YAML has been around a while now. So I think we should chuck a “validate YAML, or blow up with a specific warning that the YAML is not valid” step early in the launcher build process.

---

<div class="post-metadata">

### Author: ![DavidGNavas](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/davidgnavas/32/68313_2.png) [@DavidGNavas](https://meta.discourse.org/u/DavidGNavas)
#### Post date: [7월 23, 2015, 10:21오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/44 "2015-07-23T10:21:03Z")

</div>

I tried this how-to and it works perfect! Thanks @techAPJ!

Only one more question: i have test my public discourse site with a SEO checker (woorank) and it shows this:

 ![](https://global.discourse-cdn.com/meta/original/3X/0/0/0068d348ed16cfcf4759d27749452a405b2aca5d.png) 

But in [meta.discourse.org](http://meta.discourse.org) it shows:

![](https://global.discourse-cdn.com/meta/original/3X/6/d/6d3c3ff3d73bdad03dcdf8567c6ed6c92d559e9f.png)

Would you recommend us to add one more block following this how-to with the IP?

Something like…

```plaintext
- file:
        path: /etc/nginx/conf.d/discourse_redirect_2.conf
        contents: |
          server {
            listen 80;
            server_name 1.222.33.444;
            return 301 $scheme://talk.example.com$request_uri;
          }

```

---

<div class="post-metadata">

### Author: ![Alankrit\_Choudh](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alankrit_choudh/32/119698_2.png) [@Alankrit\_Choudh](https://meta.discourse.org/u/Alankrit_Choudh)
#### Post date: [11월 16, 2015, 5:42오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/45 "2015-11-16T05:42:24Z")

</div>

Can i use the same code to re-direct from [https://www.mysite.com](https://www.mysite.com) to non [https://mysite.com](https://mysite.com) ?

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [11월 16, 2015, 7:52오전 UTC](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492/46 "2015-11-16T07:52:14Z")

</div>

> [@Alankrit\_Choudh](#):
>
> Can i use the same code to re-direct from [https://www.mysite.com](https://www.mysite.com) to non [https://mysite.com](https://mysite.com) ?

Yes you can (after making some changes in URLs), but as @riking mentioned earlier, it’s not recommended.

> [@(Superseded) Redirect additional domain(s) to your Discourse instance](https://meta.discourse.org/t/redirect-single-multiple-domain-s-to-your-discourse-instance/18492/11):
>
> It is not recommended to put Discourse on the root domain, because cookies set on the root domain carry over to all others, and you might end up with max-length cookie errors if you ever want anything else there.

[이전 페이지](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492.md?page=1)

[다음 페이지](https://meta.discourse.org/t/superseded-redirect-additional-domain-s-to-your-discourse-instance/18492.md?page=3)
