# Docker subfolder install not working due to Ember-CLI proxy error?

**URL:** https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217
**Category:** Self-hosting
**Tags:** unsupported-install, docker
**Created:** [October 18, 2022, 3:40pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217 "2022-10-18T15:40:57Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [October 18, 2022, 3:40pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/1 "2022-10-18T15:40:57Z")

</div>

(I’ve tagged this #unsupported-install but would appreciate guru input regardless 🙂)

Guys, I’m trying to run a basic Discourse image in a simple-ish(?) multi docker container setup via Docker Compose.

Here’s the basics:

- The forum is living in a subfolder, lets call it `/board`, so (`https://blah.com/board`)
- nginx is passing calls to `/board:443` to `localhost:4000`.
- Discourse rails was running on port 4000 (because 3000 is being used by something else)
- included in the Rails ENVs is a crucial setting which sets this up to work:  
DISCOURSE\_RELATIVE\_URL\_ROOT: “/board”

Now I’ve updated the version of Discourse (pre Ember-CLI) and things are no longer working.

So, of course, I add a container for Ember-CLI which runs:

```plaintext
discourse-ember:
    command: bin/ember-cli --port 4000 --proxy "http://localhost:4200"

```

So Ember is now handling the calls coming in on 4000 in the first instance.

I move Discourse rails container to port 4200 and kick things off.

First the good news:

- curling the dev site works!

Now the bad news:

- Doesn’t work in browser, why?:

`/bootstrap.json`

giving the error:

```plaintext
Discourse Ember CLI Proxy Error
Error: Could not get http://0.0.0.0:4200/bootstrap.json

FetchError: invalid json response body at http://0.0.0.0:4200/bootstrap.json?for_url=%2Fboard reason: Unexpected token N in JSON at position 0

```

instead of

`/board/bootstrap.json` (which returns data).

If instead I use this config:

```plaintext
  discourse-ember:
    command: bin/ember-cli --port 4000 --proxy "http://0.0.0.0:4200/forum"

```

I get a Rails error:

```plaintext
Routing Error
No route matches [GET] "/forum"

```

Yet not a few lines away, it provides me with:

```plaintext
bootstrap_path	GET	/bootstrap(.:format)	
bootstrap#index {:format=>/(json|html|\*\/\*)/}

```

Which is exactly the path I was trying to reach?

How do I make Ember smart enough to proxy to the subfolder when it’s trying to get the bootstrap info?, ie:

```plaintext
http://0.0.0.0:4200/forum/bootstrap.json

```

Remember, in this instance, Ember is running in its own container.

---

<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: [October 18, 2022, 3:47pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/2 "2022-10-18T15:47:19Z")

</div>

How are you building the container? You’re launching that container from docker-compose?

There was . . . uh, some env setting . . . that could be used to try to keep ember-cli from working; did you remove that? (I think it’s ignored now anyway?)

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [October 18, 2022, 3:48pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/3 "2022-10-18T15:48:04Z")

</div>

Yes, these container definitions are in a docker-compose.

There are no environment settings in the ember-cli container currently.

---

<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: [October 18, 2022, 3:52pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/4 "2022-10-18T15:52:22Z")

</div>

You’re building the container with launcher with the stuff from [Serve Discourse from a subfolder (path prefix) instead of a subdomain](https://meta.discourse.org/t/serve-discourse-from-a-subfolder-path-prefix-instead-of-a-subdomain/30507) before you get docker-compose to launch it?

What’s the proxy? Maybe just launch discourse with launcher and use docker-args to set other stuff that is needed? For traefik, I do something like this:

```plaintext
        --docker-args "-l traefik.frontend.rule=Host:{{discourse_hostname}};PathPrefix:/{{discourse_subfolder}} \
        -l traefik.frontend.entryPoints=https \
        -l traefik.backend={{discourse_shortname}} \
        -l traefik.port=80 \
        {{ docker_extra_args | default('')}}"

```

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [October 18, 2022, 3:55pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/5 "2022-10-18T15:55:20Z")

</div>

> [@pfaffman](#):
>
> You’re building the container with launcher

No, I’m just using a Discourse Docker Image (version 2.8.9).

(actually the image is hosted locally, but its pretty much:)

```plaintext
  discourse:
    command: bin/rails s -b 0.0.0.0 -p 4200
    image: discourse:v2.8.9
    environment:
      DISCOURSE_PORT: 4200
      DISCOURSE_RELATIVE_URL_ROOT: “/board”
     <SNIP>
    ports:
      - 4200:4200

```

```plaintext
  discourse-ember:
    command: bin/ember-cli --port 4000 --proxy "http://0.0.0.0:4200"
    image: discourse:v2.8.9
    ports:
      - 4000:4000

```

---

<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: [October 18, 2022, 4:24pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/6 "2022-10-18T16:24:45Z")

</div>

Hmm. In that case I can’t explain how it ever worked. I think you need to build an image with launcher that adds the stuff to support subfolder installs.

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [October 18, 2022, 9:42pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/7 "2022-10-18T21:42:49Z")

</div>

Solved.

My bad for not adding this to the Ember CLI container (it was already on the Rails container):

```plaintext
DISCOURSE_RELATIVE_URL_ROOT: "/board"

```

Ooops 😅

FYI the key file in source is I believe this:

> <https://github.com/discourse/discourse/blob/6c49ec39ea520195e00d31d57da33608af278d65/app/assets/javascripts/discourse/config/environment.js#L7>

---

<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: [November 17, 2022, 9:42pm UTC](https://meta.discourse.org/t/docker-subfolder-install-not-working-due-to-ember-cli-proxy-error/242217/8 "2022-11-17T21:42:54Z")

</div>

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