Caddy Server + Docker + Traefik returns "404 Site domain.com is not served on this interface" Caddy Server + Docker + Traefik returns "404 Site domain.com is not served on this interface" docker docker

Caddy Server + Docker + Traefik returns "404 Site domain.com is not served on this interface"


Caddy is looking for a request looking for localhost:2015. I would guess that you are forwarding a request to the machine but not to localhost.

Start Caddy with the -log path/to/log.log parameter and you may see what the request is, or try

:2015root /srv/app/public

This will serve any request coming in on port 2015.


Container networking requires that your app inside the container listen on all interfaces. Docker cannot reach the loopback interface inside your container from outside of the container, including published ports and container to container networking.

If you want to limit access to this port on your docker host, you can limit what interfaces docker publishes the port:

version: '3'services:  my_project:    image: some_registry/my_project    ports:      - "127.0.0.1:2015:2015"    labels:      - "traefik.frontend.rule=Host:subdomain.domain.me"

Inside the container, follow Toby's advice to adjust the caddy configuration by removing "localhost" from your Caddyfile.