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

**URL:** https://discuss.openedx.org/t/caddy-hanging-because-of-ambiguous-site-definition-lms-and-cms-down/11271
**Category:** Site Operators
**Created:** [September 21, 2023, 10:09pm UTC](https://discuss.openedx.org/t/caddy-hanging-because-of-ambiguous-site-definition-lms-and-cms-down/11271 "2023-09-21T22:09:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Spuds](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/spuds/32/5871_2.png) [@Spuds](https://discuss.openedx.org/u/Spuds)
#### Post date: [September 21, 2023, 10:09pm UTC](https://discuss.openedx.org/t/caddy-hanging-because-of-ambiguous-site-definition-lms-and-cms-down/11271/1 "2023-09-21T22:09:04Z")

</div>

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:

```auto
{"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:

```auto
# 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

---

<div class="post-metadata">

### Author: ![joel.edwards](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/joel.edwards/32/3193_2.png) [@joel.edwards](https://discuss.openedx.org/u/joel.edwards)
#### Post date: [September 22, 2023, 10:01am UTC](https://discuss.openedx.org/t/caddy-hanging-because-of-ambiguous-site-definition-lms-and-cms-down/11271/2 "2023-09-22T10:01:31Z")

</div>

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

```auto
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**

---

<div class="post-metadata">

### Author: ![Spuds](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/spuds/32/5871_2.png) [@Spuds](https://discuss.openedx.org/u/Spuds)
#### Post date: [September 22, 2023, 10:16am UTC](https://discuss.openedx.org/t/caddy-hanging-because-of-ambiguous-site-definition-lms-and-cms-down/11271/3 "2023-09-22T10:16:17Z")

</div>

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

---

<div class="post-metadata">

### Author: ![joel.edwards](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/joel.edwards/32/3193_2.png) [@joel.edwards](https://discuss.openedx.org/u/joel.edwards)
#### Post date: [September 22, 2023, 11:54am UTC](https://discuss.openedx.org/t/caddy-hanging-because-of-ambiguous-site-definition-lms-and-cms-down/11271/4 "2023-09-22T11:54:12Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Spuds](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.openedx.org/spuds/32/5871_2.png) [@Spuds](https://discuss.openedx.org/u/Spuds)
#### Post date: [September 22, 2023, 12:56pm UTC](https://discuss.openedx.org/t/caddy-hanging-because-of-ambiguous-site-definition-lms-and-cms-down/11271/5 "2023-09-22T12:56:02Z")

</div>

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