{
    email admin@edudeploy.com
    on_demand_tls {
        ask http://server:3000/api/check-domain
    }
}

:80 {
    route /edubox-agent* {
        file_server {
            root /usr/share/caddy/agent
        }
    }
    route /api/websocket* {
        reverse_proxy server:3001
    }
    route /api/check-domain* {
        reverse_proxy server:3000
    }
    route * {
        redir https://{host}{uri} permanent
    }
}

headscale.alfrednobel.edudeploy.com {
    reverse_proxy headscale:8080
}

alfrednobel.edudeploy.com {
    reverse_proxy /api/websocket* server:3001
    reverse_proxy server:3000
}

:443 {
    tls {
        on_demand
    }
    reverse_proxy /api/websocket* server:3001
    reverse_proxy server:3000
}
