diff --git a/cmd/main.go b/cmd/main.go index d8e5f7bc..54d11d88 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -137,7 +137,9 @@ func loadConfig(configFile, adapterName string) ([]byte, error) { // as a special case, if a config file called "Caddyfile" was // specified, and no adapter is specified, assume caddyfile adapter // for convenience - if filepath.Base(configFile) == "Caddyfile" && adapterName == "" { + if strings.HasPrefix(filepath.Base(configFile), "Caddyfile") && + filepath.Ext(configFile) != ".json" && + adapterName == "" { adapterName = "caddyfile" }