Merge branch v2.11 into v3.0
This commit is contained in:
commit
9f145dbc28
130 changed files with 245 additions and 322 deletions
|
@ -4,7 +4,9 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"math"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/containous/alice"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
@ -21,6 +23,8 @@ import (
|
|||
"github.com/traefik/traefik/v3/pkg/tls"
|
||||
)
|
||||
|
||||
const maxUserPriority = math.MaxInt - 1000
|
||||
|
||||
type middlewareBuilder interface {
|
||||
BuildChain(ctx context.Context, names []string) *alice.Chain
|
||||
}
|
||||
|
@ -65,8 +69,6 @@ func (m *Manager) BuildHandlers(rootCtx context.Context, entryPoints []string, t
|
|||
entryPointHandlers := make(map[string]http.Handler)
|
||||
|
||||
for entryPointName, routers := range m.getHTTPRouters(rootCtx, entryPoints, tls) {
|
||||
entryPointName := entryPointName
|
||||
|
||||
logger := log.Ctx(rootCtx).With().Str(logs.EntryPointName, entryPointName).Logger()
|
||||
ctx := logger.WithContext(rootCtx)
|
||||
|
||||
|
@ -121,6 +123,13 @@ func (m *Manager) buildEntryPointHandler(ctx context.Context, entryPointName str
|
|||
routerConfig.Priority = httpmuxer.GetRulePriority(routerConfig.Rule)
|
||||
}
|
||||
|
||||
if routerConfig.Priority > maxUserPriority && !strings.HasSuffix(routerName, "@internal") {
|
||||
err = fmt.Errorf("the router priority %d exceeds the max user-defined priority %d", routerConfig.Priority, maxUserPriority)
|
||||
routerConfig.AddError(err, true)
|
||||
logger.Error().Err(err).Send()
|
||||
continue
|
||||
}
|
||||
|
||||
handler, err := m.buildRouterHandler(ctxRouter, routerName, routerConfig)
|
||||
if err != nil {
|
||||
routerConfig.AddError(err, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue