Unrecongnized directive: on_demand

1. Caddy version (2.2.1):

2. How I run Caddy:

a. System environment:

systemd

b. Command:

systemctl status caddy

c. Service/unit/compose file:

paste full file contents here

d. My complete Caddyfile or JSON config:

{
    on_demand_tls {
        ask https://mydomain.com/caddy/allowed-domain
    }

}

:80 {
    respond /health "Im healthy!" 200
}

:443 {
    tls myemail@gmail.com {
        on_demand
    }

    reverse_proxy 1.1.1.1 1.1.1.2
}

3. The problem I’m having:

I was going to start caddy.

4. Error messages and/or full log output:

5. What I already tried:

I did this in v.2.1.2 and it’s worked well. On other server, it’s working now too.

6. Links to relevant resources:

Thanks

The Caddyfile you posted looks correct, but there’s clearly a syntax error somewhere. You must have missed a brace in your config.

What’s your full, unredacted Caddyfile? I can’t help debug a syntax error if you don’t show exactly the contents, unmodified.

And to grab your logs in a friendlier way, you can use journalctl --no-pager -u caddy | less and type Shift+G to jump to the bottom.

You’re missing a space between the email address and {. Spaces are very important for the Caddyfile to correctly parse the tokens.

2 Likes

@francislavoie
WoW, it worked!!!
Thank you so much. :grinning:

1 Like

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