Ordering of site blocks in caddyfile

1. Caddy version (caddy version):

2.2.1-1.fc33

2. How I run Caddy:

a. System environment:

Fedora Server 33

b. Command:

/usr/bin/caddy validate --config /etc/caddy/Caddyfile

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

http:// {

    root * /usr/share/caddy
    file_server

}
import Caddyfile.d/*.caddyfile
example.com {
        root * /var/www
        file_server browse
}

3. The problem I’m having:

http://example.com/ show the content of /usr/share/caddy instead of /var/www, although https://example.com/ works as expected.

4. Error messages and/or full log output:

5. What I already tried:

Changed http:// to :80, but did not work

6. Links to relevant resources:

https://github.com/caddyserver/caddy/commit/32cafbb6309c8d78cc7e2f2a75def9c633944ef8

Does it still happen on 2.3.0? (Or better yet, the latest beta?)

Please upgrade to v2.3.0!

Caddy will show you a warning about this at startup in your logs:

user server is listening on same interface as automatic HTTP->HTTPS redirects; user-configured routes might override these redirects

This is “intended” behaviour, but there’s discussion about improving the situation in this issue (it’s a long and contentious one):

Thank you guys, I already upgrade to 2.3.0-1.fc34, still not work.
Will try on 2.4 when it is available on Fedora 34.

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