Skip to content

Improve error message when trying to define a global matcher  #6332

@autoantwort

Description

@autoantwort

For me it was not obvious from the documentation that it is forbidden to write global matchers, so I wrote:

@rwth-netz client_ip 134.130.0.0/16 137.226.0.0/16 134.61.0.0/16 192.35.229.0/24 10.72.0.0/16 2a00:8a60::/32
@hilton-net client_ip 134.130.55.0/24 10.72.0.0/16 2a00:8a60:e005::0/48

(https_proxy) {
  reverse_proxy https://{args[0]} {
    transport http {
      tls_insecure_skip_verify
    }
  }
}

alt.xxx.de {
  import https_proxy 10.72.4.27
}

db.xxx.de {
  reverse_proxy @rwth-netz 10.72.4.31
}
... lot of rules using the matchers

But the error message I got was

╰─# caddy validate           
2024/05/21 13:56:17.288	INFO	using adjacent Caddyfile
2024/05/21 13:56:17.288	INFO	using provided configuration	{"config_file": "Caddyfile", "config_adapter": ""}
Error: adapting config using caddyfile: File to import not found: https_proxy, at Caddyfile:20

The error message is very misleading.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions