diff --git a/autogen/gentemplates/gen.go b/autogen/gentemplates/gen.go index 455c05ed6..d0437b0d2 100644 --- a/autogen/gentemplates/gen.go +++ b/autogen/gentemplates/gen.go @@ -575,7 +575,13 @@ var _templatesKvTmpl = []byte(`{{$frontends := List .Prefix "/frontends/" }} {{$entryPoints := GetList . "/entrypoints"}} [frontends."{{$frontend}}"] backend = "{{Get "" . "/backend"}}" + {{ $passHostHeader := Get "" . "/passhostheader"}} + {{if $passHostHeader}} + passHostHeader = {{ $passHostHeader }} + {{else}} + # keep for compatibility reason passHostHeader = {{Get "true" . "/passHostHeader"}} + {{end}} priority = {{Get "0" . "/priority"}} entryPoints = [{{range $entryPoints}} "{{.}}", diff --git a/docs/user-guide/kv-config.md b/docs/user-guide/kv-config.md index 5366ebfce..e1d4bfcba 100644 --- a/docs/user-guide/kv-config.md +++ b/docs/user-guide/kv-config.md @@ -328,7 +328,7 @@ And there, the same dynamic configuration in a KV Store (using `prefix = "traefi | Key | Value | |----------------------------------------------------|--------------------| | `/traefik/frontends/frontend2/backend` | `backend1` | -| `/traefik/frontends/frontend2/passHostHeader` | `true` | +| `/traefik/frontends/frontend2/passhostheader` | `true` | | `/traefik/frontends/frontend2/priority` | `10` | | `/traefik/frontends/frontend2/entrypoints` | `http,https` | | `/traefik/frontends/frontend2/routes/test_2/rule` | `PathPrefix:/test` | diff --git a/templates/kv.tmpl b/templates/kv.tmpl index 21de5604e..6023dd2e6 100644 --- a/templates/kv.tmpl +++ b/templates/kv.tmpl @@ -53,7 +53,13 @@ {{$entryPoints := GetList . "/entrypoints"}} [frontends."{{$frontend}}"] backend = "{{Get "" . "/backend"}}" + {{ $passHostHeader := Get "" . "/passhostheader"}} + {{if $passHostHeader}} + passHostHeader = {{ $passHostHeader }} + {{else}} + # keep for compatibility reason passHostHeader = {{Get "true" . "/passHostHeader"}} + {{end}} priority = {{Get "0" . "/priority"}} entryPoints = [{{range $entryPoints}} "{{.}}",