From b380522df88c721fb4424cb1f59a38f1c6136051 Mon Sep 17 00:00:00 2001 From: Ludovic Fernandez Date: Tue, 24 Dec 2019 17:36:04 +0100 Subject: [PATCH] fix: dashboard redirect loop --- integration/testdata/rawdata-ingress.json | 2 +- pkg/provider/traefik/fixtures/api_insecure_with_dashboard.json | 2 +- pkg/provider/traefik/fixtures/full_configuration.json | 2 +- pkg/provider/traefik/internal.go | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/testdata/rawdata-ingress.json b/integration/testdata/rawdata-ingress.json index b70c3b552..45518f455 100644 --- a/integration/testdata/rawdata-ingress.json +++ b/integration/testdata/rawdata-ingress.json @@ -60,7 +60,7 @@ "middlewares": { "dashboard_redirect@internal": { "redirectRegex": { - "regex": "^(http:\\/\\/[^:]+(:\\d+)?)/$", + "regex": "^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$", "replacement": "${1}/dashboard/", "permanent": true }, diff --git a/pkg/provider/traefik/fixtures/api_insecure_with_dashboard.json b/pkg/provider/traefik/fixtures/api_insecure_with_dashboard.json index 60f72a7f7..e4a1e2ee4 100644 --- a/pkg/provider/traefik/fixtures/api_insecure_with_dashboard.json +++ b/pkg/provider/traefik/fixtures/api_insecure_with_dashboard.json @@ -25,7 +25,7 @@ "middlewares": { "dashboard_redirect": { "redirectRegex": { - "regex": "^(http:\\/\\/[^:]+(:\\d+)?)/$", + "regex": "^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$", "replacement": "${1}/dashboard/", "permanent": true } diff --git a/pkg/provider/traefik/fixtures/full_configuration.json b/pkg/provider/traefik/fixtures/full_configuration.json index e8c3a9ec6..f4852fcb5 100644 --- a/pkg/provider/traefik/fixtures/full_configuration.json +++ b/pkg/provider/traefik/fixtures/full_configuration.json @@ -57,7 +57,7 @@ "middlewares": { "dashboard_redirect": { "redirectRegex": { - "regex": "^(http:\\/\\/[^:]+(:\\d+)?)/$", + "regex": "^(http:\\/\\/[^:\\/]+(:\\d+)?)\\/$", "replacement": "${1}/dashboard/", "permanent": true } diff --git a/pkg/provider/traefik/internal.go b/pkg/provider/traefik/internal.go index 1501b29a0..091d2b13f 100644 --- a/pkg/provider/traefik/internal.go +++ b/pkg/provider/traefik/internal.go @@ -86,7 +86,7 @@ func (i *Provider) apiConfiguration(cfg *dynamic.Configuration) { cfg.HTTP.Middlewares["dashboard_redirect"] = &dynamic.Middleware{ RedirectRegex: &dynamic.RedirectRegex{ - Regex: `^(http:\/\/[^:]+(:\d+)?)/$`, + Regex: `^(http:\/\/[^:\/]+(:\d+)?)\/$`, Replacement: "${1}/dashboard/", Permanent: true, },