Fix models mechanism for default rule syntax

Co-authored-by: Kevin Pollet <pollet.kevin@gmail.com>
This commit is contained in:
Romain 2024-11-29 10:52:05 +01:00 committed by GitHub
parent 536e11d949
commit 2b35c7e205
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 11 deletions

View file

@ -2,6 +2,7 @@ package server
import (
"slices"
"strings"
"github.com/go-acme/lego/v4/challenge/tlsalpn01"
"github.com/rs/zerolog/log"
@ -156,7 +157,11 @@ func applyModel(cfg dynamic.Configuration) dynamic.Configuration {
router := rt.DeepCopy()
if !router.DefaultRule && router.RuleSyntax == "" {
for _, model := range cfg.HTTP.Models {
for modelName, model := range cfg.HTTP.Models {
// models cannot be provided by another provider than the internal one.
if !strings.HasSuffix(modelName, "@internal") {
continue
}
router.RuleSyntax = model.DefaultRuleSyntax
break
}