plugin/rewrite: normalize exact cname rewrite targets and preserve all records (#8285)

Signed-off-by: ncesam <rybushkin09@bk.ru>
This commit is contained in:
Ncesam
2026-07-16 05:06:03 +04:00
committed by GitHub
parent 99b683aa41
commit e1f4d0cb90
2 changed files with 23 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"github.com/coredns/coredns/plugin"
"github.com/coredns/coredns/plugin/pkg/log"
"github.com/coredns/coredns/plugin/pkg/upstream"
"github.com/coredns/coredns/request"
@@ -139,6 +140,10 @@ func newCNAMERule(nextAction string, args ...string) (Rule, error) {
} else {
return nil, fmt.Errorf("too few (%d) arguments for a cname rule", len(args))
}
if rewriteType == ExactMatch {
paramFromTarget = plugin.Name(paramFromTarget).Normalize()
paramToTarget = plugin.Name(paramToTarget).Normalize()
}
rule := cnameTargetRule{
rewriteType: rewriteType,
paramFromTarget: paramFromTarget,