mirror of
https://github.com/traefik/traefik.git
synced 2026-05-05 04:16:25 +02:00
Fix app-root with query params redirect
This commit is contained in:
parent
2b9ffc4261
commit
4b678ce9fd
@ -715,7 +715,7 @@ type RedirectScheme struct {
|
||||
Permanent bool `json:"permanent,omitempty" toml:"permanent,omitempty" yaml:"permanent,omitempty" export:"true"`
|
||||
// ForcePermanentRedirect is an internal field (not exposed in configuration).
|
||||
// When set to true, this forces the use of permanent redirects 308, regardless of the request method.
|
||||
// Used by the provider ingress-ngin.
|
||||
// Used by the provider ingress-nginx.
|
||||
ForcePermanentRedirect bool `json:"-" toml:"-" yaml:"-" label:"-" file:"-" kv:"-" export:"true"`
|
||||
}
|
||||
|
||||
|
||||
@ -1675,7 +1675,7 @@ func applyAppRootConfiguration(routerName string, ingressConfig IngressConfig, r
|
||||
appRootMiddlewareName := routerName + "-app-root"
|
||||
conf.HTTP.Middlewares[appRootMiddlewareName] = &dynamic.Middleware{
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1" + *ingressConfig.AppRoot,
|
||||
},
|
||||
}
|
||||
|
||||
@ -3859,13 +3859,13 @@ func TestLoadIngresses(t *testing.T) {
|
||||
Middlewares: map[string]*dynamic.Middleware{
|
||||
"default-ingress-with-app-root-rule-0-path-0-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
"default-ingress-with-app-root-rule-0-path-0-tls-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
@ -11528,25 +11528,25 @@ func TestLoadIngresses(t *testing.T) {
|
||||
Middlewares: map[string]*dynamic.Middleware{
|
||||
"default-ingress-with-canary-middlewares-rule-0-path-0-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
"default-ingress-with-canary-middlewares-rule-0-path-0-tls-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
"default-ingress-with-canary-middlewares-rule-0-path-0-canary-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
"default-ingress-with-canary-middlewares-rule-0-path-0-canary-tls-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
@ -11828,13 +11828,13 @@ func TestLoadIngresses(t *testing.T) {
|
||||
Middlewares: map[string]*dynamic.Middleware{
|
||||
"default-ingress-with-canary-middlewares-and-tls-rule-0-path-0-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
"default-ingress-with-canary-middlewares-and-tls-rule-0-path-0-tls-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
@ -11850,13 +11850,13 @@ func TestLoadIngresses(t *testing.T) {
|
||||
},
|
||||
"default-ingress-with-canary-middlewares-and-tls-rule-0-path-0-canary-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
"default-ingress-with-canary-middlewares-and-tls-rule-0-path-0-canary-tls-app-root": {
|
||||
RedirectRegex: &dynamic.RedirectRegex{
|
||||
Regex: `^(https?://[^/]+)/$`,
|
||||
Regex: `^(https?://[^/]+)/(\?.*)?$`,
|
||||
Replacement: "$1/foo",
|
||||
},
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user