# Need help setting up discourse using Caddy as rproxy

**URL:** https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456
**Category:** Self-hosting
**Tags:** hosting
**Created:** [September 8, 2022, 12:47pm UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456 "2022-09-08T12:47:23Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Tinsmith6176](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tinsmith6176](https://meta.discourse.org/u/Tinsmith6176)
#### Post date: [September 8, 2022, 12:47pm UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/1 "2022-09-08T12:47:23Z")

</div>

If i’m not posting this in the right section, i’m sorry.

I’m using Oracle Free tier as my server, and i have a Ubuntu installation with a couple of docker containers running.  
I’m using Caddy, also running in docker, as rproxy for all my containers.

Now i need to setup Discourse as the last piece of the puzzle, but i’m not sure how to proceed.  
I have testet and installed Discourse with a standard docker installation on my other testserver, but that’s the whole package, and if i need to use caddy as rproxy, i need to disable some of the features i guess?

If anyone could point me in the right direction, i would much appriceate it.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [September 8, 2022, 12:50pm UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/2 "2022-09-08T12:50:29Z")

</div>

This might be helpful:

> [@Use Caddy instead of NGINX as your reverse proxy](https://meta.discourse.org/t/running-discourse-with-caddy-server/54716):
>
> [image] Here are some notes about how I got my test Discourse instance running with [Caddy Server](https://caddyserver.com/). Cool stuff about Caddy: They [use Discourse](https://caddy.community/) smile[Free SSL](https://caddyserver.com/docs/automatic-https) with Let’s Encrypt HTTP2 and [QUIC](https://www.chromium.org/quic) out of the box Easier to configure than nginx Cons: Not as battle tested as apache, nginx and cia. How To Preparing Discourse First, you need to apply this changes to your app.yml: templates: - "templates/postgres.template.yml" - "templates/redis.template.yml" - "templates/web.t…

---

<div class="post-metadata">

### Author: ![Tinsmith6176](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tinsmith6176](https://meta.discourse.org/u/Tinsmith6176)
#### Post date: [September 8, 2022, 2:01pm UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/3 "2022-09-08T14:01:29Z")

</div>

I think that got me on the right track. I’m not sure i’m pointing to the right path though.

in my app.yml I have set my volumes here:  
And i can build my Discourse without problems.

```plaintext
volumes:
  - volume:
      host: /opt/docker/docker_configs/discourse/shared/standalone
      guest: /shared
  - volume:
      host: /opt/docker/docker_configs/discourse/shared/standalone/log/var-log
      guest: /var/log

```

And reading that forumthread, i tried a couple of things with my Caddyfile.

```plaintext
forum.mydomain.com {
  reverse_proxy unix//opt/docker/docker_configs/discourse/shared/standalone/nginx.http.sock
  import cloudflare
}

```

```plaintext
forum.mydomain.com {
  reverse_proxy /opt/docker/docker_configs/discourse/shared/standalone/nginx.http.sock
  import cloudflare
}

```

Neither of them work, but i’m really not sure i’m doing it right though xD

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [September 9, 2022, 3:18am UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/4 "2022-09-09T03:18:10Z")

</div>

How are you starting caddy?

> [@Use Caddy instead of NGINX as your reverse proxy](https://meta.discourse.org/t/use-caddy-instead-of-nginx-as-your-reverse-proxy/54716/1):
>
> ` -v /var/discourse/shared/standalone:/sock \`

This line from the original topic needs to be adjusted for your directory for this to work. Unless the correct directory is mounted in caddy container, it can not see the socket created by discourse.

---

<div class="post-metadata">

### Author: ![Tinsmith6176](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tinsmith6176](https://meta.discourse.org/u/Tinsmith6176)
#### Post date: [September 9, 2022, 6:23am UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/5 "2022-09-09T06:23:30Z")

</div>

Arh, you mean that i need to mount the discourse sock to caddy? that makes sense!

I tried something else last night however.  
When discourse is started, it is running in a docker bridge network. If i just add the docker-default network that all my other containers, including Caddy, is in, then i can simply add it to caddy like i do with all my other containers.

```plaintext
forum.mydomain.com {
  reverse_proxy app:80
  import cloudflare
}

```

I couldn’t figure out where the docker network is defined in all those yml files though. If i could change it from the bridge to run in docker default, all is fixed for me.

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [September 9, 2022, 6:31am UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/6 "2022-09-09T06:31:08Z")

</div>

This might be helpful:

> [@Use Nginx Proxy Manager to manage multiple sites with Discourse](https://meta.discourse.org/t/using-nginx-proxy-manager-to-manage-multiple-sites-with-discourse/206344#h-2-bring-all-containers-into-the-default-bridge-network-3):
>
> EDIT: @pfaffman re-wrote this as a standalone topic from what @tophee had written earlier. It’s not yet tested by me, and I’ve moved around Chris’s words, so any mistakes are likely those of @pfaffman. Are there any reasons not to use [NGINX Proxy Manager](https://nginxproxymanager.com/) instead of doing this manually as described in [Run other websites on the same machine as Discourse](https://meta.discourse.org/t/running-other-websites-on-the-same-machine-as-discourse/17247)? I’m already using it. I’ve had it on my home server for a while and when I migrated my discourse instance to a new cloud server, I realized t…

While it is for Nginx Proxy Manager, It describes the process of bringing containers under default bridge.

---

<div class="post-metadata">

### Author: ![Tinsmith6176](https://avatars.discourse-cdn.com/v4/letter/t/87869e/32.png) [@Tinsmith6176](https://meta.discourse.org/u/Tinsmith6176)
#### Post date: [September 9, 2022, 7:20am UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/7 "2022-09-09T07:20:26Z")

</div>

Yes! it works!

I had to change a couple of things, but it is almost as the first thread you linked.

In Caddyfile i had to write it like this  
Which is a bit different than written in the thread.

```plaintext
forum.mydomain.com {
  reverse_proxy unix//sock/nginx.http.sock
  import cloudflare
}

```

and I’ve added the volume, which of course makes sense when i now think of it.  
I’m using docker-compose.

```plaintext
  caddy:
    container_name: Caddy
    build:
      dockerfile: ./caddy-config/Dockerfile
      context: .
    labels:
      com.centurylinklabs.watchtower.enable: "false"
    ports:
      - 80:80
      - 443:443
    volumes:
      - ./docker_configs/caddy/data:/data
      - ./docker_configs/caddy/Caddyfile:/etc/caddy/Caddyfile
      - ./docker_configs/caddy/srv:/srv
      - /var/discourse/shared/standalone:/sock
    restart: always

```

Thanks alot for the help!

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [September 9, 2022, 7:46am UTC](https://meta.discourse.org/t/need-help-setting-up-discourse-using-caddy-as-rproxy/238456/8 "2022-09-09T07:46:49Z")

</div>

> [@Tinsmith6176](#):
>
> a bit different than written in the thread.

That is probably due to upstream changes in Caddy itself. The image linked in the topic still works with the provided configuration afaik.
