mirror of
https://github.com/alibaba/higress.git
synced 2026-06-05 18:57:30 +08:00
fix: Eliminate compatibility risk of matching all domains for an MCP server (#2973)
This commit is contained in:
@@ -53,7 +53,8 @@ func (a mcpServer) Parse(annotations Annotations, config *Ingress, globalContext
|
||||
var matchRuleDomains []string
|
||||
rawMatchRuleDomains, _ := annotations.ParseStringASAP(mcpServerMatchRuleDomains)
|
||||
if rawMatchRuleDomains == "" || rawMatchRuleDomains == "*" {
|
||||
// Match all domains. Leave an empty slice.
|
||||
// Use wildcard to match all domains so we don't rely on the default behavior of empty domain list
|
||||
matchRuleDomains = []string{"*"}
|
||||
} else if strings.Contains(rawMatchRuleDomains, ",") {
|
||||
matchRuleDomains = strings.Split(rawMatchRuleDomains, ",")
|
||||
} else {
|
||||
|
||||
@@ -132,7 +132,7 @@ func TestMCPServer_Parse(t *testing.T) {
|
||||
},
|
||||
expect: &mcpserver.McpServer{
|
||||
Name: "default/route",
|
||||
Domains: nil,
|
||||
Domains: []string{"*"},
|
||||
PathMatchType: "prefix",
|
||||
PathMatchValue: "/mcp",
|
||||
UpstreamType: "rest",
|
||||
@@ -153,7 +153,7 @@ func TestMCPServer_Parse(t *testing.T) {
|
||||
},
|
||||
expect: &mcpserver.McpServer{
|
||||
Name: "default/route",
|
||||
Domains: nil,
|
||||
Domains: []string{"*"},
|
||||
PathMatchType: "prefix",
|
||||
PathMatchValue: "/mcp",
|
||||
UpstreamType: "rest",
|
||||
|
||||
Reference in New Issue
Block a user