SchemeRedirect Middleware

Co-authored-by: jbdoumenjou <jb.doumenjou@gmail.com>
This commit is contained in:
Gérald Croës 2019-01-21 23:30:04 -08:00 committed by Traefiker Bot
parent 04958c6951
commit a433e469cc
11 changed files with 407 additions and 66 deletions

View file

@ -17,7 +17,8 @@ type Middleware struct {
Headers *Headers `json:"headers,omitempty"`
Errors *ErrorPage `json:"errors,omitempty"`
RateLimit *RateLimit `json:"rateLimit,omitempty"`
Redirect *Redirect `json:"redirect,omitempty"`
RedirectRegex *RedirectRegex `json:"redirectregex,omitempty"`
RedirectScheme *RedirectScheme `json:"redirectscheme,omitempty"`
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
DigestAuth *DigestAuth `json:"digestAuth,omitempty"`
ForwardAuth *ForwardAuth `json:"forwardAuth,omitempty"`
@ -229,13 +230,20 @@ func (r *RateLimit) SetDefaults() {
r.ExtractorFunc = "request.host"
}
// Redirect holds the redirection configuration of an entry point to another, or to an URL.
type Redirect struct {
// RedirectRegex holds the redirection configuration.
type RedirectRegex struct {
Regex string `json:"regex,omitempty"`
Replacement string `json:"replacement,omitempty"`
Permanent bool `json:"permanent,omitempty"`
}
// RedirectScheme holds the scheme redirection configuration.
type RedirectScheme struct {
Scheme string `json:"scheme,omitempty"`
Port string `json:"port,omitempty"`
Permanent bool `json:"permanent,omitempty"`
}
// ReplacePath holds the ReplacePath configuration.
type ReplacePath struct {
Path string `json:"path,omitempty"`
@ -247,7 +255,7 @@ type ReplacePathRegex struct {
Replacement string `json:"replacement,omitempty"`
}
// Retry contains request retry config
// Retry holds the retry configuration.
type Retry struct {
Attempts int `description:"Number of attempts" export:"true"`
}