Caddy for Enclave (Reverse Proxy)

1. Caddy version (caddy version):

2.4.3, I believe

2. How I run Caddy:

Docker compose, split over different directories.
Caddy is under the caddy dir, and other sites/apps in their own (i.e. wordpress, enclave, etc.), each containing their own docker-compose file.

a. System environment:

Ubuntu 20.04, and Docker/Docker Compose

b. Command:

From within the caddy dir:

docker-compose up -d

c. Service/unit/compose file:

Caddy docker-compose

version: '3.7'                               
        image: caddy:latest                  
        container_name: caddy                
        restart: unless-stopped              
            - "80:80"                        
            - "443:443"                      
        - $PWD/Caddyfile:/etc/caddy/Caddyfile
        - $PWD/site:/srv                     
        - caddy_data:/data                   
        - caddy_config:/config               

d. My complete Caddyfile or JSON config:

wordpress.domain.tld {
  reverse_proxy wordpress:4000
  # also tried :80/:443

enclave.domain.tld {
  reverse_proxy enclave:5000

3. The problem I’m having:

Simply put, when visiting the subdomains, I am greeted with a whitescreen, and nothing else.
The DNS does resolve successfully, as when I don’t run the Caddy container, the “site cannot be found”.
If I don’t have the DNS set up, it does to my main site (as intended).

What I would like to achieve, eventually, is to use enclave to gain access to my homeserver which is locked behind CGNAT (all inbound traffic is blocked).
I have plans to have a couple of WordPress sites too, in containers.

Remote → DO Droplet, with Docker → Caddy send to containers → either WordPress sites, or Enclave → Home Server

4. Error messages and/or full log output:

5. What I already tried:

I’ve tried two different tutorials (linked below), and both lead to a similar issue.
I have been able to get a successful whoami via the browser, but nothing else.

6. Links to relevant resources:

You can run this command to check (while Caddy is running)

docker-compose exec caddy caddy version

Use curl -v to make the requests. What do you see?

What’s in Caddy’s logs? Run docker-compose logs caddy.

So I assume you have a wordpress container, but it’s not in the above docker-compose.yml. If you’re using an external network, it’s also not in that docker-compose.yml. Make sure the containers are in the same network so they can communicate with eachother.

Also, are you sure your wordpress container is using port 4000? That’s not the default as per the docs on Docker Hub, it listens on port 80. So use wordpress:80 instead if using the default wordpress config.

1 Like

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