Support RegularExpression for path matching

This commit is contained in:
Dimitris Mavrommatis 2024-05-23 20:08:03 +02:00 committed by GitHub
parent 0e215f9b61
commit 6e61fe0de1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 30 additions and 1 deletions

View file

@ -1300,6 +1300,12 @@ func TestLoadHTTPRoutes(t *testing.T) {
Rule: "Host(`foo.com`) && Path(`/bar`) && Header(`my-header`,`bar`)",
RuleSyntax: "v3",
},
"default-http-app-1-my-gateway-web-d23f7039bc8036fb918c": {
EntryPoints: []string{"web"},
Service: "default-http-app-1-my-gateway-web-d23f7039bc8036fb918c-wrr",
Rule: "Host(`foo.com`) && PathRegexp(`^/buzz/[0-9]+$`)",
RuleSyntax: "v3",
},
},
Middlewares: map[string]*dynamic.Middleware{},
Services: map[string]*dynamic.Service{
@ -1323,6 +1329,16 @@ func TestLoadHTTPRoutes(t *testing.T) {
},
},
},
"default-http-app-1-my-gateway-web-d23f7039bc8036fb918c-wrr": {
Weighted: &dynamic.WeightedRoundRobin{
Services: []dynamic.WRRService{
{
Name: "default-whoami-80",
Weight: func(i int) *int { return &i }(1),
},
},
},
},
"default-whoami-80": {
LoadBalancer: &dynamic.ServersLoadBalancer{
Servers: []dynamic.Server{