Skip to content

Commit d085dc0

Browse files
fix(gateway): reject identical main and sandbox vhost in the xDS path
The RuntimeDeployConfig transform already rejects a config whose main and sandbox resolve to the same vhost, where sandbox routes would collide with main routes on the same route key. The router xDS path built sandbox routes without that guard, so the two paths disagreed. Add the same check to the xDS path so both reject the configuration consistently.
1 parent f6332a7 commit d085dc0

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

gateway/gateway-controller/pkg/xds/translator.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,13 @@ func (t *Translator) translateAPIConfig(cfg *models.StoredConfig, allConfigs []*
866866
}
867867
}
868868
if hasSandbox {
869+
// Guard: sandbox and main vhosts must differ, otherwise sandbox routes share
870+
// the route key with main routes and collide. This mirrors the same check in
871+
// the RuntimeDeployConfig transform path so both paths reject this
872+
// configuration consistently.
873+
if effectiveMainVHost == effectiveSandboxVHost {
874+
return nil, nil, fmt.Errorf("sandbox upstream is configured but resolves to the same vhost %q as the main upstream; configure distinct vhosts to avoid route conflicts", effectiveMainVHost)
875+
}
869876
var sbClusterName string
870877
var parsedSbURL *url.URL
871878
var sbTimeout *resolvedTimeout

0 commit comments

Comments
 (0)