Add option to preserve request method in forwardAuth
This commit is contained in:
parent
2b6a04bc1d
commit
2afa03b55c
15 changed files with 139 additions and 5 deletions
|
@ -791,6 +791,7 @@ func createForwardAuthMiddleware(k8sClient Client, namespace string, auth *traef
|
|||
AddAuthCookiesToResponse: auth.AddAuthCookiesToResponse,
|
||||
ForwardBody: auth.ForwardBody,
|
||||
PreserveLocationHeader: auth.PreserveLocationHeader,
|
||||
PreserveRequestMethod: auth.PreserveRequestMethod,
|
||||
}
|
||||
forwardAuth.SetDefaults()
|
||||
|
||||
|
|
|
@ -167,6 +167,8 @@ type ForwardAuth struct {
|
|||
MaxBodySize *int64 `json:"maxBodySize,omitempty"`
|
||||
// PreserveLocationHeader defines whether to forward the Location header to the client as is or prefix it with the domain name of the authentication server.
|
||||
PreserveLocationHeader bool `json:"preserveLocationHeader,omitempty"`
|
||||
// PreserveRequestMethod defines whether to preserve the original request method while forwarding the request to the authentication server.
|
||||
PreserveRequestMethod bool `json:"preserveRequestMethod,omitempty"`
|
||||
}
|
||||
|
||||
// ClientTLS holds the client TLS configuration.
|
||||
|
|
|
@ -91,6 +91,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||
"traefik/http/middlewares/Middleware08/forwardAuth/forwardBody": "true",
|
||||
"traefik/http/middlewares/Middleware08/forwardAuth/maxBodySize": "42",
|
||||
"traefik/http/middlewares/Middleware08/forwardAuth/preserveLocationHeader": "true",
|
||||
"traefik/http/middlewares/Middleware08/forwardAuth/preserveRequestMethod": "true",
|
||||
"traefik/http/middlewares/Middleware15/redirectScheme/scheme": "foobar",
|
||||
"traefik/http/middlewares/Middleware15/redirectScheme/port": "foobar",
|
||||
"traefik/http/middlewares/Middleware15/redirectScheme/permanent": "true",
|
||||
|
@ -446,6 +447,7 @@ func Test_buildConfiguration(t *testing.T) {
|
|||
ForwardBody: true,
|
||||
MaxBodySize: pointer(int64(42)),
|
||||
PreserveLocationHeader: true,
|
||||
PreserveRequestMethod: true,
|
||||
},
|
||||
},
|
||||
"Middleware06": {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue