From 0b1dd69b010d843de204dd9c199b36267ac5ef46 Mon Sep 17 00:00:00 2001 From: Regner Blok-Andersen Date: Fri, 10 Feb 2017 03:05:59 -0800 Subject: [PATCH] Added support for passHostHeader annotation on ingresses --- provider/kubernetes.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/provider/kubernetes.go b/provider/kubernetes.go index 0e845b42a..9efcc71ec 100644 --- a/provider/kubernetes.go +++ b/provider/kubernetes.go @@ -107,7 +107,6 @@ func (provider *Kubernetes) loadIngresses(k8sClient k8s.Client) (*types.Configur map[string]*types.Backend{}, map[string]*types.Frontend{}, } - PassHostHeader := provider.getPassHostHeader() for _, i := range ingresses { for _, r := range i.Spec.Rules { if r.HTTP == nil { @@ -124,6 +123,18 @@ func (provider *Kubernetes) loadIngresses(k8sClient k8s.Client) (*types.Configur }, } } + + PassHostHeader := provider.getPassHostHeader() + + passHostHeaderAnnotation := i.Annotations["traefik.frontend.passHostHeader"] + switch passHostHeaderAnnotation { + case "true": + PassHostHeader = true + case "false": + PassHostHeader = false + + } + if _, exists := templateObjects.Frontends[r.Host+pa.Path]; !exists { templateObjects.Frontends[r.Host+pa.Path] = &types.Frontend{ Backend: r.Host + pa.Path,