caddyserver / caddy

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS
https://caddyserver.com
Apache License 2.0
55.83k stars 3.93k forks source link

Can't use `cert_issuer zerossl` in Global options after upgrade 2.3 #3953

Closed W0n9 closed 3 years ago

W0n9 commented 3 years ago

1. Caddy version (caddy version):

2.3.0

2. How I run Caddy:

Docker

a. System environment:

Docker 19.03.13, Ubuntu 20.04

b. Command:

docker run -itd \
    --name=caddy \
    --net=host \
    --restart=always \
    --ulimit nofile=1048576 \
    -v /etc/caddy/Caddyfile:/etc/caddy/Caddyfile \
    -v /root/caddy/caddy_data:/data \
    -v /root/caddy/caddy_config:/config \
    -v /root/caddy/files:/files \
    caddy

c. My complete Caddyfile or JSON config:

{
    order filter after encode
    on_demand_tls {
        interval 5s
        burst 10
    }
    cert_issuer zerossl api_key
}

catest.buct.edu.cn {
    encode zstd gzip
    respond / {remote_host}{tls_cipher}{tls_version}
    handle_errors {
        respond "{http.error.status_code} {http.error.status_text}"
    }
    tls {
        on_demand
    }
    header Strict-Transport-Security max-age=31536000;
}

http://course.buct.edu.cn {
    redir https://course-proxy2.buct.edu.cn 303
}

:9180 {
    metrics /metrics
}

3. The problem I'm having:

When I start caddy, it raised an error, which is loading config: loading new config: loading tls app module: tls: invalid configuration: automation policy 2 is the second policy that acts as default/catch-all, but will never be used

4. Error messages and/or full log output:

{"level":"info","ts":1609670773.2256284,"msg":"using provided configuration","config_file":"/etc/caddy/Caddyfile","config_adapter":"caddyfile"} reload: sending configuration to instance: caddy responded with error: HTTP 400: {"error":"loading config: loading new config: loading tls app module: tls: invalid configuration: automation policy 2 is the second policy that acts as default/catch-all, but will never be used"}

5. What I already tried:

When I deleted the http block or :9180 block, even cert_issuer zerossl api_key, it returned to normal, but I don`t know what caused it.

6. Link to thread in caddy.community:

https://caddy.community/t/cant-use-cert-issuer-zerossl-in-global-options-after-upgrade-2-3/11002/8

mholt commented 3 years ago

Thanks for the report. Turns out I was missing one little i-- in the code. Pushing a fix in a moment.

mholt commented 3 years ago

Possible regression, see https://github.com/caddyserver/caddy/issues/4101