Caddy hanging because of "ambiguous site definition" - LMS and CMS down

I have referred to as many threads as I can find on this error and while there was some insightful information there, none really struck at the heart of the problem.

We used tutor config to make a change to the smtp settings and things seemed to go swimmingly but then when starting up, I noticed the container for caddy was bouncing so I looked into the logs and saw this:

{"level":"info","ts":1695332850.226727,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"}
Error: adapting config using caddyfile: ambiguous site definition: tutor.lit.ai

So I found the Caddyfile on the filesystem and took a look and to be honest, I’m not sure if what is here is allowed or not… the hostname IS in here twice and that is probably the violation, but if I comment out the portion that imports the MFE then courses don’t work. If I leave it in, the site won’t start.

Can anyone give me any pointers on what to do? Here is our Caddyfile:

# Global configuration
{



}

# proxy directive snippet (with logging) to be used as follows:
#
#     import proxy "containername:port"
(proxy) {
    log {
        output stdout
        format filter {
            wrap json
            fields {
                common_log delete
                request>headers delete
                resp_headers delete
                tls delete
            }
        }
    }

    # This will compress requests that matches the default criteria set by Caddy.
    # see https://caddyserver.com/docs/caddyfile/directives/encode
    # for information about the defaults; i.e. how/when this will be applied.
    encode gzip

    reverse_proxy {args.0} {
        header_up X-Forwarded-Port 443
    }
}

tutor.lit.ai{$default_site_port}, preview.tutor.lit.ai{$default_site_port} {
    @favicon_matcher {
        path_regexp ^/favicon.ico$
    }
    rewrite @favicon_matcher /theming/asset/images/favicon.ico

    # Limit profile image upload size
    handle_path /api/profile_images/*/*/upload {
        request_body {
            max_size 1MB
        }
    }

    import proxy "lms:8000"



    handle_path /* {
        request_body {
            max_size 4MB
        }
    }
}

studio.tutor.lit.ai{$default_site_port} {
    @favicon_matcher {
        path_regexp ^/favicon.ico$
    }
    rewrite @favicon_matcher /theming/asset/images/favicon.ico

    import proxy "cms:8000"



    handle_path /* {
        request_body {
            max_size 250MB
        }
    }
}

tutor.lit.ai{$default_site_port} {
    respond / 204
    request_body {
        max_size 2MB
    }
    import proxy "mfe:8002"
}

Thanks in advance for your consideration! I appreciate all of you hard-working EdX admins because it must be a thankless and long job… I have been up to my ears and I’m just getting started.

-Spuds

if my caddyfile is anything to go by then your last entry should be

apps.tutor.lit.ai{$default_site_port} {
    respond / 204
    request_body {
        max_size 2MB
    }
    import proxy "mfe:8002"
}

Make sure you have DNS records set up for all entries as well:
DNS A record: tutor.lit.ai → to your server IP
DNS CNAME record: apps.tutor.lit.ai → link to tutor.lit.ai
DNS CNAME record: studio.tutor.lit.ai → link to tutor.lit.ai
DNS CNAME record: preview.tutor.lit.ai → link to tutor.lit.ai

We just solved this about an hour ago and I believe the result was something DNS-related resolved the issue, but I want to look at what they did tomorrow and make sure that it was a solid fix and not just a workaround.

But I want to extend my thanks to you for shoring up our suspicions!

-Spuds

you’re welcome! check back anytime, very helpful community here :slight_smile:

I do have a related question-- what do you have set for your MFE_HOST? Or even better… what should we set ( if anything).