mirror of
https://github.com/coredns/coredns.git
synced 2025-10-28 08:44:17 -04:00
plugin/forward: health_check needs to normalize a specified domain name (#5543)
* plugin/forward: convert the specified domain of health_check to Fqdn * plugin/forward: update readme for health check Signed-off-by: vanceli <vanceli@tencent.com>
This commit is contained in:
@@ -14,6 +14,8 @@ import (
|
||||
"github.com/coredns/coredns/plugin/pkg/parse"
|
||||
pkgtls "github.com/coredns/coredns/plugin/pkg/tls"
|
||||
"github.com/coredns/coredns/plugin/pkg/transport"
|
||||
|
||||
"github.com/miekg/dns"
|
||||
)
|
||||
|
||||
func init() { plugin.Register("forward", setup) }
|
||||
@@ -204,7 +206,11 @@ func parseBlock(c *caddy.Controller, f *Forward) error {
|
||||
if !c.NextArg() {
|
||||
return c.ArgErr()
|
||||
}
|
||||
f.opts.hcDomain = c.Val()
|
||||
hcDomain := c.Val()
|
||||
if _, ok := dns.IsDomainName(hcDomain); !ok {
|
||||
return fmt.Errorf("health_check: invalid domain name %s", hcDomain)
|
||||
}
|
||||
f.opts.hcDomain = plugin.Name(hcDomain).Normalize()
|
||||
default:
|
||||
return fmt.Errorf("health_check: unknown option %s", hcOpts)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user