Caddy results in a Blank Page - What is wrong in the Configuration

1. The problem I’m having:

My Configuration for host @owui and @bar returns a blank ssl certified page…

The @bar is already in the documentation, anyway that also don’t show the response but the blank page…

The @owui is a open-webui docker container… I tested whether it is working by manually going to zakee.duckdns.org:8080… It did work, but does not show through the reverse proxy…

However the host @ptnr worked, It worked as shown in the following tutorial by the way…

2. Error messages and/or full log output:

zakee@debserver:~/Docker-Compose/Caddy$ docker compose logs
caddy  | {"level":"info","ts":1741447096.5248005,"msg":"using config from file","file":"/etc/caddy/Caddyfile"}
caddy  | {"level":"info","ts":1741447096.5308602,"msg":"adapted config to JSON","adapter":"caddyfile"}
caddy  | {"level":"info","ts":1741447096.5326748,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//[::1]:2019","//127.0.0.1:2019","//localhost:2019"]}
caddy  | {"level":"info","ts":1741447096.5338056,"logger":"http.auto_https","msg":"server is listening only on the HTTPS port but has no TLS connection policies; adding one to enable TLS","server_name":"srv0","https_port":443}
caddy  | {"level":"info","ts":1741447096.5339386,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
caddy  | {"level":"info","ts":1741447096.5362804,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0xc000291b00"}
caddy  | {"level":"info","ts":1741447096.5387661,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
caddy  | {"level":"info","ts":1741447096.5404227,"msg":"failed to sufficiently increase receive buffer size (was: 208 kiB, wanted: 7168 kiB, got: 416 kiB). See https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes for details."}
caddy  | {"level":"info","ts":1741447096.5417938,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
caddy  | {"level":"warn","ts":1741447096.5423102,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":80"}
caddy  | {"level":"warn","ts":1741447096.5423324,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":80"}
caddy  | {"level":"info","ts":1741447096.5423427,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
caddy  | {"level":"info","ts":1741447096.542354,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["*.zakee.duckdns.org"]}
caddy  | {"level":"info","ts":1741447096.5577765,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"1b75d764-3ddc-4edd-81c1-37d79960af1f","try_again":1741533496.5577736,"try_again_in":86399.9999995}
caddy  | {"level":"info","ts":1741447096.5604632,"logger":"tls","msg":"finished cleaning storage units"}
caddy  | {"level":"info","ts":1741447096.564922,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
caddy  | {"level":"info","ts":1741447096.56506,"msg":"serving initial configuration"}

3. Caddy version:

zakee@debserver:~/Docker-Compose/Caddy$ docker compose exec caddy caddy version
v2.9.1 h1:OEYiZ7DbCzAWVb6TNEkjRcSCRGHVoZsJinoDR/n9oaY=

4. How I installed and ran Caddy:

a. System environment:

zakee@debserver:~/Docker-Compose/Caddy$ cat /etc/os-release 
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

zakee@debserver:~/Docker-Compose/Caddy$ docker -v
Docker version 28.0.1, build 068a01e

b. Command:

docker compose up -d

c. Service/unit/compose file:

services:
  caddy:
    build:
      context: .
      dockerfile: Dockerfile
    container_name: caddy
    restart: unless-stopped
    env_file:
      - .env
    environment:
      - DUCKDNS_EMAIL=${DD_EMAIL}
      - DUCKDNS_API_TOKEN=${DD_API_TOKEN}
      - ACME_AGREE=true
    ports:
      - 80:80
      - 443:443
    volumes:
      - config:/config
      - data:/data
      - ./Caddyfile:/etc/caddy/Caddyfile
#      - ./index.html:/usr/share/caddy/index.html
    networks:
      - caddy # add other containers onto this network to use dns name

volumes:
  config:
  data:

# create this first before running the docker-compose - docker network create caddy
networks:
  caddy:
    external: true
# For prod you'd want to pin the version: e.g., 2.9.1-builder
FROM caddy:2.9.1-builder-alpine AS builder

RUN xcaddy build \
    --with github.com/caddy-dns/duckdns
FROM caddy:latest

COPY --from=builder /usr/bin/caddy /usr/bin/caddy

d. My complete Caddy config:

Syntax Used: Common Caddyfile Patterns — Caddy Documentation

*.zakee.duckdns.org {
	tls {
		dns duckdns {env.DD_API_TOKEN}
		propagation_delay 2m
		resolvers 1.1.1.1
	}

	@ptnr host ptnr.zakee.duckdns.org
	handle @ptnr {
		reverse_proxy https://portainer:9443 {
			transport http {
				tls
				tls_insecure_skip_verify
			}
		}

		@owui host owui.zakee.duckdns.org
		handle @owui {
			reverse_proxy open-webui:8080
		}

		@bar host bar.zakee.duckdns.org
		handle @bar {
			respond "Bar!"
		}
	}

Everything is inside this handle, which is only matching on requests for host ptnr.zakee.duckdns.org. You’re trying to make bar.zakee.duckdns.org work, but bar is not ptnr.

Thank You so much… I failed to notice that there is a bracket of @ptnr which was not closed… Now it works as it should… Have a nice day :heart:.

*.zakee.duckdns.org {
	tls {
		dns duckdns {env.DD_API_TOKEN}
		propagation_delay 2m
		resolvers 1.1.1.1
	}
	handle_errors {
		respond "{err.status_code} {err.status_text}"
	}
	@ptnr host ptnr.zakee.duckdns.org
	handle @ptnr {
		reverse_proxy portainer:9443 {
			transport http {
				tls
				tls_insecure_skip_verify
			}
		}
	}

	@owui host owui.zakee.duckdns.org
	handle @owui {
		reverse_proxy open-webui:8080
	}

	@bar host bar.zakee.duckdns.org
	handle @bar {
		respond "Bar!"
	}
}