1
0
Fork 0

Fix backend reuse

This commit is contained in:
Arne Jørgensen 2018-06-06 17:56:03 +02:00 committed by Traefiker Bot
parent 9cf4e730e7
commit 51227241b7
4 changed files with 94 additions and 8 deletions

View file

@ -16,6 +16,7 @@ import (
"github.com/containous/mux"
"github.com/containous/traefik/log"
traefiktls "github.com/containous/traefik/tls"
"github.com/mitchellh/hashstructure"
"github.com/ryanuber/go-glob"
)
@ -177,9 +178,9 @@ func (h *Headers) HasSecureHeadersDefined() bool {
// Frontend holds frontend configuration.
type Frontend struct {
EntryPoints []string `json:"entryPoints,omitempty"`
EntryPoints []string `json:"entryPoints,omitempty" hash:"ignore"`
Backend string `json:"backend,omitempty"`
Routes map[string]Route `json:"routes,omitempty"`
Routes map[string]Route `json:"routes,omitempty" hash:"ignore"`
PassHostHeader bool `json:"passHostHeader,omitempty"`
PassTLSCert bool `json:"passTLSCert,omitempty"`
Priority int `json:"priority"`
@ -192,6 +193,17 @@ type Frontend struct {
Redirect *Redirect `json:"redirect,omitempty"`
}
// Hash returns the hash value of a Frontend struct.
func (f *Frontend) Hash() (string, error) {
hash, err := hashstructure.Hash(f, nil)
if err != nil {
return "", err
}
return strconv.FormatUint(hash, 10), nil
}
// Redirect configures a redirection of an entry point to another, or to an URL
type Redirect struct {
EntryPoint string `json:"entryPoint,omitempty"`