-
Notifications
You must be signed in to change notification settings - Fork 788
Description
Plugin name and version: os-caddy (current master)
Describe the bug
When a non-wildcard domain entry like blog.example.com has Dynamic DNS enabled, the Caddyfile template generates an incorrect dynamic_dns domains block:
dynamic_dns {
domains {
blog.example.com @
}
}
The caddy-dynamicdns module treats the first field as the DNS zone name. Since blog.example.com is not a DNS zone (the zone is example.com), the DNS provider lookup fails silently and the record never gets updated.
The correct output should be:
dynamic_dns {
domains {
example.com blog
}
}
Steps to reproduce
- Create a domain entry with
FromDomainset toblog.example.com(not a wildcard, not a bare domain) - Enable Dynamic DNS on this entry
- Reconfigure Caddy
- Check the generated Caddyfile - the dynamic_dns block will have
blog.example.com @instead ofexample.com blog
Root cause
In the Caddyfile template (line 155), the else branch for non-wildcard domain entries appends cleanedDomain + " @" without checking if the domain is a subdomain (has more than 2 parts). The subdomain loop (lines 161-164) already has the correct split logic but it only applies to entries created as subdomains under a wildcard parent.
Current workaround
Create a wildcard parent domain (*.example.com) and nest subdomains under it. This forces the subdomain template path which correctly splits the zone and record name.