From 63f65e5b2a20ad94c5eea6fb2963166baca3c1a6 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Thu, 17 Dec 2020 10:06:03 +0100 Subject: [PATCH 1/2] Disable router when a rule has an error --- pkg/rules/rules.go | 9 ++++++++- pkg/rules/rules_test.go | 10 ++++++++++ pkg/server/router/router_test.go | 23 +++++++++++++++++++++++ 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/pkg/rules/rules.go b/pkg/rules/rules.go index 469bcbe56..a6bfedb1b 100644 --- a/pkg/rules/rules.go +++ b/pkg/rules/rules.go @@ -59,7 +59,14 @@ func (r *Router) AddRoute(rule string, priority int, handler http.Handler) error } route := r.NewRoute().Handler(handler).Priority(priority) - return addRuleOnRoute(route, buildTree()) + + err = addRuleOnRoute(route, buildTree()) + if err != nil { + route.BuildOnly() + return err + } + + return nil } type tree struct { diff --git a/pkg/rules/rules_test.go b/pkg/rules/rules_test.go index a6a79eace..ca38ef28f 100644 --- a/pkg/rules/rules_test.go +++ b/pkg/rules/rules_test.go @@ -29,6 +29,16 @@ func Test_addRoute(t *testing.T) { rule: "rulewithnotmatcher", expectedError: true, }, + { + desc: "Host empty", + rule: "Host(``)", + expectedError: true, + }, + { + desc: "PathPrefix empty", + rule: "PathPrefix(``)", + expectedError: true, + }, { desc: "PathPrefix", rule: "PathPrefix(`/foo`)", diff --git a/pkg/server/router/router_test.go b/pkg/server/router/router_test.go index 703de3c37..19ed56252 100644 --- a/pkg/server/router/router_test.go +++ b/pkg/server/router/router_test.go @@ -62,6 +62,29 @@ func TestRouterManager_Get(t *testing.T) { entryPoints: []string{"web"}, expected: expectedResult{StatusCode: http.StatusOK}, }, + { + desc: "empty host", + routersConfig: map[string]*dynamic.Router{ + "foo": { + EntryPoints: []string{"web"}, + Service: "foo-service", + Rule: "Host(``)", + }, + }, + serviceConfig: map[string]*dynamic.Service{ + "foo-service": { + LoadBalancer: &dynamic.ServersLoadBalancer{ + Servers: []dynamic.Server{ + { + URL: server.URL, + }, + }, + }, + }, + }, + entryPoints: []string{"web"}, + expected: expectedResult{StatusCode: http.StatusNotFound}, + }, { desc: "no load balancer", routersConfig: map[string]*dynamic.Router{ From 3ff83fc1f8281851e56dcc5f18600be8fbb6fe9f Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Doumenjou <925513+jbdoumenjou@users.noreply.github.com> Date: Thu, 17 Dec 2020 17:02:04 +0100 Subject: [PATCH 2/2] Prepare release v2.3.6 --- CHANGELOG.md | 12 ++++++++++++ script/gcg/traefik-bugfix.toml | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7b266e52..b80555cd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,15 @@ +## [v2.3.6](https://github.com/traefik/traefik/tree/v2.3.6) (2020-12-17) +[All Commits](https://github.com/traefik/traefik/compare/v2.3.5...v2.3.6) + +**Bug fixes:** +- **[logs]** Update Logrus to v1.7.0 ([#7663](https://github.com/traefik/traefik/pull/7663) by [jspdown](https://github.com/jspdown)) +- **[plugins]** Update Yaegi to v0.9.8 ([#7659](https://github.com/traefik/traefik/pull/7659) by [ldez](https://github.com/ldez)) +- **[rules]** Disable router when a rule has an error ([#7680](https://github.com/traefik/traefik/pull/7680) by [ldez](https://github.com/ldez)) + +**Documentation:** +- **[logs]** Add configuration example for access log filePath ([#7655](https://github.com/traefik/traefik/pull/7655) by [wernerfred](https://github.com/wernerfred)) +- **[middleware]** Add missing quotes in errorpages k8s example yaml ([#7675](https://github.com/traefik/traefik/pull/7675) by [icelynjennings](https://github.com/icelynjennings)) + ## [v2.3.5](https://github.com/traefik/traefik/tree/v2.3.5) (2020-12-10) [All Commits](https://github.com/traefik/traefik/compare/v2.3.4...v2.3.5) diff --git a/script/gcg/traefik-bugfix.toml b/script/gcg/traefik-bugfix.toml index 408b454d1..01c1e79c1 100644 --- a/script/gcg/traefik-bugfix.toml +++ b/script/gcg/traefik-bugfix.toml @@ -6,9 +6,9 @@ FileName = "traefik_changelog.md" # example new bugfix v2.3.5 CurrentRef = "v2.3" -PreviousRef = "v2.3.4" +PreviousRef = "v2.3.5" BaseBranch = "v2.3" -FutureCurrentRefName = "v2.3.5" +FutureCurrentRefName = "v2.3.6" ThresholdPreviousRef = 10 ThresholdCurrentRef = 10