"ambiguous site definition" error

1. Output of caddy version:

# docker exec -it caddy caddy version
v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

a. System environment:

Caddy running in a docker container (host is Arch)

c. Service/unit/compose file:

version: "3"

networks:
  srv:
    external: true
    name: srv

services:
  caddy:
    image: caddy:2
    container_name: caddy
    volumes:
      - /etc/docker/caddy/data/Caddyfile:/etc/caddy/Caddyfile
      - /etc/docker/caddy/data/sites:/data
      - /etc/docker/caddy/data/config:/config
      - /etc/docker:/etc/docker:ro
    ports:
      - 80:80
      - 443:443
      - 2015:2015
    environment:
      - ACME_AGREE=true
      - LAN_NETWORKS=192.168.10.0/24 192.168.20.0/24 172.18.0.0/16 86.238.84.44/32
    restart: unless-stopped
    networks:
      - srv

d. My complete Caddy config:

{
	admin 0.0.0.0:2015
	email REDACTED
	# acme_ca https://acme-staging-v02.api.letsencrypt.org/directory
	log {
		level ERROR
	}
}

https://syncthing-rpi-dash.swtk.eu {
	reverse_proxy rpi-dash.swtk.info:8384
}

3. The problem I’m having:

When starting caddy, I see

4. Error messages and/or full log output:

caddy  | Error: adapting config using caddyfile: ambiguous site definition: https://syncthing-rpi-dash.swtk.eu
caddy  | {"level":"info","ts":1670849026.009774,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}

5. What I already tried:

This is a new error on a previously working version (the last restrat of caddy much have been about 2 weeks ago, so early December 2022). Some minor changes were done in my network, but not around naming or IP ranges.

https://syncthing-rpi-dash.swtk.eu is the name I would like to use to access rpi-dash.swtk.info:8384. Caddy runs on a system, rpi-dash.swtk.info is another one on the same network.

When looking at the code I noticed around caddy/httptype.go at master · caddyserver/caddy · GitHub the following comment which I do not exactly understand (in the referred Issue, @mholt mentions that this is a “particular area of the code”, which does not sound good for my problem :))

What does

  // detect ambiguous site definitions: server blocks which
  // have the same host bound to the same interface (listener
  // address), otherwise their routes will improperly be added
  // to the same server (see issue #4635)

mean in the context of my reverse proxy?

You can remove this – it was only used by Caddy v1. Caddy v2 no longer reads this.

Is that really your entire config? I’m not sure how there could be an ambiguity when there’s only a single site.

If I try to adapt that as-is, I don’t see a problem.

1 Like

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