1
0
Fork 0

Redirection: permanent move option.

This commit is contained in:
Ludovic Fernandez 2018-01-31 19:10:04 +01:00 committed by Traefiker
parent c944d203fb
commit 58d6681824
83 changed files with 622 additions and 8611 deletions

View file

@ -95,6 +95,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
withPair(pathFrontendRedirectEntryPoint, "https"),
withPair(pathFrontendRedirectRegex, "nope"),
withPair(pathFrontendRedirectReplacement, "nope"),
withPair(pathFrontendRedirectPermanent, "true"),
withErrorPage("foo", "error", "/test1", "500-501, 503-599"),
withErrorPage("bar", "error", "/test2", "400-405"),
withRateLimit("client.ip",
@ -186,6 +187,7 @@ func TestProviderBuildConfiguration(t *testing.T) {
BasicAuth: []string{"test:$apr1$H6uskkkW$IgXLP6ewTrSuBkTrqE8wj/", "test2:$apr1$d9hr9HBB$4HxwgUir3HP4EsggP/QNo0"},
Redirect: &types.Redirect{
EntryPoint: "https",
Permanent: true,
},
Errors: map[string]*types.ErrorPage{
"foo": {
@ -1044,6 +1046,18 @@ func TestProviderGetRedirect(t *testing.T) {
EntryPoint: "https",
},
},
{
desc: "should use entry point when entry point key is valued in the store (permanent)",
rootPath: "traefik/frontends/foo",
kvPairs: filler("traefik",
frontend("foo",
withPair(pathFrontendRedirectEntryPoint, "https"),
withPair(pathFrontendRedirectPermanent, "true"))),
expected: &types.Redirect{
EntryPoint: "https",
Permanent: true,
},
},
{
desc: "should use regex when regex keys are valued in the store",
rootPath: "traefik/frontends/foo",
@ -1056,6 +1070,20 @@ func TestProviderGetRedirect(t *testing.T) {
Replacement: "$1",
},
},
{
desc: "should use regex when regex keys are valued in the store (permanent)",
rootPath: "traefik/frontends/foo",
kvPairs: filler("traefik",
frontend("foo",
withPair(pathFrontendRedirectRegex, "(.*)"),
withPair(pathFrontendRedirectReplacement, "$1"),
withPair(pathFrontendRedirectPermanent, "true"))),
expected: &types.Redirect{
Regex: "(.*)",
Replacement: "$1",
Permanent: true,
},
},
{
desc: "should only use entry point when entry point and regex base are valued in the store",
rootPath: "traefik/frontends/foo",