middleware/etc: normalize the zone correctly (#597)

Also don't default to a default proxy; keep it empty.
Normalize the zones, so that is the server block ones are used, it will
actually work.
This commit is contained in:
Miek Gieben
2017-03-16 14:52:30 +00:00
committed by GitHub
parent 5ac6020f45
commit 36c743a4d8

View File

@@ -49,7 +49,8 @@ func setup(c *caddy.Controller) error {
func etcdParse(c *caddy.Controller) (*Etcd, bool, error) {
stub := make(map[string]proxy.Proxy)
etc := Etcd{
Proxy: proxy.NewLookup([]string{"8.8.8.8:53", "8.8.4.4:53"}),
// Don't default to a proxy for lookups.
// Proxy: proxy.NewLookup([]string{"8.8.8.8:53", "8.8.4.4:53"}),
PathPrefix: "skydns",
Ctx: context.Background(),
Inflight: &singleflight.Group{},
@@ -68,7 +69,10 @@ func etcdParse(c *caddy.Controller) (*Etcd, bool, error) {
etc.Zones = make([]string, len(c.ServerBlockKeys))
copy(etc.Zones, c.ServerBlockKeys)
}
middleware.Zones(etc.Zones).Normalize()
for i, str := range etc.Zones {
etc.Zones[i] = middleware.Host(str).Normalize()
}
if c.NextBlock() {
// TODO(miek): 2 switches?
switch c.Val() {