Repository: containous/traefik
Pull request #5516 (2019-09-27 07:40:34)

fix: default passHostHeader for file provider.

### What does this PR do?

default passHostHeader for file provider.

### Motivation

Have homogeneous behavior between all providers.

### More

- [x] Added/updated tests
- [ ] ~~Added/updated documentation~~



Patch:
diff --git a/pkg/config/dynamic/http_config.go b/pkg/config/dynamic/http_config.go
index ab56419bd..c98e10697 100644
--- a/pkg/config/dynamic/http_config.go
+++ b/pkg/config/dynamic/http_config.go
@@ -106,7 +106,7 @@ type ServersLoadBalancer struct {
 	Sticky             *Sticky             `json:"sticky,omitempty" toml:"sticky,omitempty" yaml:"sticky,omitempty" label:"allowEmpty"`
 	Servers            []Server            `json:"servers,omitempty" toml:"servers,omitempty" yaml:"servers,omitempty" label-slice-as-struct:"server"`
 	HealthCheck        *HealthCheck        `json:"healthCheck,omitempty" toml:"healthCheck,omitempty" yaml:"healthCheck,omitempty"`
-	PassHostHeader     bool                `json:"passHostHeader" toml:"passHostHeader" yaml:"passHostHeader"`
+	PassHostHeader     *bool               `json:"passHostHeader" toml:"passHostHeader" yaml:"passHostHeader"`
 	ResponseForwarding *ResponseForwarding `json:"responseForwarding,omitempty" toml:"responseForwarding,omitempty" yaml:"responseForwarding,omitempty"`
 }
 
@@ -129,7 +129,8 @@ func (l *ServersLoadBalancer) Mergeable(loadBalancer *ServersLoadBalancer) bool
 
 // SetDefaults Default values for a ServersLoadBalancer.
 func (l *ServersLoadBalancer) SetDefaults() {
-	l.PassHostHeader = true
+	defaultPassHostHeader := true
+	l.PassHostHeader = &defaultPassHostHeader
 }
 
 // +k8s:deepcopy-gen=true
diff --git a/pkg/provider/kubernetes/crd/kubernetes_http.go b/pkg/provider/kubernetes/crd/kubernetes_http.go
index b6835bce1..2a6f13b13 100644
--- a/pkg/provider/kubernetes/crd/kubernetes_http.go
+++ b/pkg/provider/kubernetes/crd/kubernetes_http.go
@@ -164,8 +164,11 @@ func createLoadBalancerServerHTTP(client Client, namespace string, service v1alp
 	lb.SetDefaults()
 
 	lb.Servers = servers
-	if service.PassHostHeader != nil {
-		lb.PassHostHeader = *service.PassHostHeader
+
+	lb.PassHostHeader = service.PassHostHeader
+	if lb.PassHostHeader == nil {
+		passHostHeader := true
+		lb.PassHostHeader = &passHostHeader
 	}
 	lb.ResponseForwarding = service.ResponseForwarding
 
diff --git a/pkg/provider/kubernetes/ingress/kubernetes.go b/pkg/provider/kubernetes/ingress/kubernetes.go
index 095e310bc..44e50cbd8 100644
--- a/pkg/provider/kubernetes/ingress/kubernetes.go
+++ b/pkg/provider/kubernetes/ingress/kubernetes.go
@@ -248,7 +248,7 @@ func loadService(client Client, namespace string, backend v1beta1.IngressBackend
 	return &dynamic.Service{
 		LoadBalancer: &dynamic.ServersLoadBalancer{
 			Servers:        servers,
-			PassHostHeader: true,
+			PassHostHeader: func(v bool) *bool { return &v }(true),
 		},
 	}, nil
 }
diff --git a/pkg/server/service/proxy.go b/pkg/server/service/proxy.go
index c19bd124f..6da65d090 100644
--- a/pkg/server/service/proxy.go
+++ b/pkg/server/service/proxy.go
@@ -21,7 +21,7 @@ const StatusClientClosedRequest = 499
 // StatusClientClosedRequestText non-standard HTTP status for client disconnection
 const StatusClientClosedRequestText = "Client Closed Request"
 
-func buildProxy(passHostHeader bool, responseForwarding *dynamic.ResponseForwarding, defaultRoundTripper http.RoundTripper, bufferPool httputil.BufferPool, responseModifier func(*http.Response) error) (http.Handler, error) {
+func buildProxy(passHostHeader *bool, responseForwarding *dynamic.ResponseForwarding, defaultRoundTripper http.RoundTripper, bufferPool httputil.BufferPool, responseModifier func(*http.Response) error) (http.Handler, error) {
 	var flushInterval types.Duration
 	if responseForwarding != nil {
 		err := flushInterval.Set(responseForwarding.FlushInterval)
@@ -53,7 +53,7 @@ func buildProxy(passHostHeader bool, responseForwarding *dynamic.ResponseForward
 			outReq.ProtoMinor = 1
 
 			// Do not pass client Host header unless optsetter PassHostHeader is set.
-			if !passHostHeader {
+			if passHostHeader != nil && !*passHostHeader {
 				outReq.Host = outReq.URL.Host
 			}
 
diff --git a/pkg/server/service/service.go b/pkg/server/service/service.go
index b138eaf17..9c000b171 100644
--- a/pkg/server/service/service.go
+++ b/pkg/server/service/service.go
@@ -176,6 +176,11 @@ func (m *Manager) getLoadBalancerServiceHandler(
 	service *dynamic.ServersLoadBalancer,
 	responseModifier func(*http.Response) error,
 ) (http.Handler, error) {
+	if service.PassHostHeader == nil {
+		defaultPassHostHeader := true
+		service.PassHostHeader = &defaultPassHostHeader
+	}
+
 	fwd, err := buildProxy(service.PassHostHeader, service.ResponseForwarding, m.defaultRoundTripper, m.bufferPool, responseModifier)
 	if err != nil {
 		return nil, err


Test patch:
diff --git a/pkg/api/handler_http_test.go b/pkg/api/handler_http_test.go
index 38286151f..b27d80d83 100644
--- a/pkg/api/handler_http_test.go
+++ b/pkg/api/handler_http_test.go
@@ -18,6 +18,8 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
+func Bool(v bool) *bool { return &v }
+
 func TestHandler_HTTP(t *testing.T) {
 	type expected struct {
 		statusCode int
@@ -267,6 +269,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.1",
@@ -283,6 +286,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.2",
@@ -351,6 +355,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.1",
@@ -367,6 +372,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.2",
@@ -383,6 +389,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.3",
@@ -412,6 +419,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.1",
@@ -429,6 +437,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.2",
@@ -459,6 +468,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.1",
@@ -476,6 +486,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.2",
@@ -506,6 +517,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.1",
@@ -534,6 +546,7 @@ func TestHandler_HTTP(t *testing.T) {
 						si := &runtime.ServiceInfo{
 							Service: &dynamic.Service{
 								LoadBalancer: &dynamic.ServersLoadBalancer{
+									PassHostHeader: Bool(true),
 									Servers: []dynamic.Server{
 										{
 											URL: "http://127.0.0.1",
diff --git a/pkg/api/handler_test.go b/pkg/api/handler_test.go
index 3fe6d3649..972ebffa5 100644
--- a/pkg/api/handler_test.go
+++ b/pkg/api/handler_test.go
@@ -38,6 +38,7 @@ func TestHandler_RawData(t *testing.T) {
 					"foo-service@myprovider": {
 						Service: &dynamic.Service{
 							LoadBalancer: &dynamic.ServersLoadBalancer{
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://127.0.0.1",
diff --git a/pkg/api/testdata/getrawdata.json b/pkg/api/testdata/getrawdata.json
index 7e1de0bbb..8ecf48483 100644
--- a/pkg/api/testdata/getrawdata.json
+++ b/pkg/api/testdata/getrawdata.json
@@ -65,7 +65,7 @@
 						"url": "http://127.0.0.1"
 					}
 				],
-				"passHostHeader": false
+				"passHostHeader": true
 			},
 			"status": "enabled",
 			"usedBy": [
diff --git a/pkg/api/testdata/service-bar.json b/pkg/api/testdata/service-bar.json
index 11e832136..e8370d9be 100644
--- a/pkg/api/testdata/service-bar.json
+++ b/pkg/api/testdata/service-bar.json
@@ -1,6 +1,6 @@
 {
 	"loadBalancer": {
-		"passHostHeader": false,
+		"passHostHeader": true,
 		"servers": [
 			{
 				"url": "http://127.0.0.1"
diff --git a/pkg/api/testdata/services-filtered-search.json b/pkg/api/testdata/services-filtered-search.json
index fd854ed72..27178e328 100644
--- a/pkg/api/testdata/services-filtered-search.json
+++ b/pkg/api/testdata/services-filtered-search.json
@@ -1,7 +1,7 @@
 [
 	{
 		"loadBalancer": {
-			"passHostHeader": false,
+			"passHostHeader": true,
 			"servers": [
 				{
 					"url": "http://127.0.0.2"
diff --git a/pkg/api/testdata/services-filtered-status.json b/pkg/api/testdata/services-filtered-status.json
index df1a52dcb..76d374b44 100644
--- a/pkg/api/testdata/services-filtered-status.json
+++ b/pkg/api/testdata/services-filtered-status.json
@@ -1,7 +1,7 @@
 [
 	{
 		"loadBalancer": {
-			"passHostHeader": false,
+			"passHostHeader": true,
 			"servers": [
 				{
 					"url": "http://127.0.0.1"
diff --git a/pkg/api/testdata/services-page2.json b/pkg/api/testdata/services-page2.json
index 9b8b5ce72..df65b3640 100644
--- a/pkg/api/testdata/services-page2.json
+++ b/pkg/api/testdata/services-page2.json
@@ -1,7 +1,7 @@
 [
 	{
 		"loadBalancer": {
-			"passHostHeader": false,
+			"passHostHeader": true,
 			"servers": [
 				{
 					"url": "http://127.0.0.2"
diff --git a/pkg/api/testdata/services.json b/pkg/api/testdata/services.json
index e96abc23b..856441e9b 100644
--- a/pkg/api/testdata/services.json
+++ b/pkg/api/testdata/services.json
@@ -1,7 +1,7 @@
 [
 	{
 		"loadBalancer": {
-			"passHostHeader": false,
+			"passHostHeader": true,
 			"servers": [
 				{
 					"url": "http://127.0.0.1"
@@ -22,7 +22,7 @@
 	},
 	{
 		"loadBalancer": {
-			"passHostHeader": false,
+			"passHostHeader": true,
 			"servers": [
 				{
 					"url": "http://127.0.0.2"
diff --git a/pkg/config/label/label_test.go b/pkg/config/label/label_test.go
index a88cb588d..63ac2f48f 100644
--- a/pkg/config/label/label_test.go
+++ b/pkg/config/label/label_test.go
@@ -544,7 +544,7 @@ func TestDecodeConfiguration(t *testing.T) {
 								"name1": "foobar",
 							},
 						},
-						PassHostHeader: true,
+						PassHostHeader: func(v bool) *bool { return &v }(true),
 						ResponseForwarding: &dynamic.ResponseForwarding{
 							FlushInterval: "foobar",
 						},
@@ -570,7 +570,7 @@ func TestDecodeConfiguration(t *testing.T) {
 								"name1": "foobar",
 							},
 						},
-						PassHostHeader: true,
+						PassHostHeader: func(v bool) *bool { return &v }(true),
 						ResponseForwarding: &dynamic.ResponseForwarding{
 							FlushInterval: "foobar",
 						},
@@ -946,7 +946,7 @@ func TestEncodeConfiguration(t *testing.T) {
 								"name1": "foobar",
 							},
 						},
-						PassHostHeader: true,
+						PassHostHeader: func(v bool) *bool { return &v }(true),
 						ResponseForwarding: &dynamic.ResponseForwarding{
 							FlushInterval: "foobar",
 						},
@@ -972,7 +972,7 @@ func TestEncodeConfiguration(t *testing.T) {
 								"name1": "foobar",
 							},
 						},
-						PassHostHeader: true,
+						PassHostHeader: func(v bool) *bool { return &v }(true),
 						ResponseForwarding: &dynamic.ResponseForwarding{
 							FlushInterval: "foobar",
 						},
diff --git a/pkg/provider/docker/config_test.go b/pkg/provider/docker/config_test.go
index e24e470d9..1788757fe 100644
--- a/pkg/provider/docker/config_test.go
+++ b/pkg/provider/docker/config_test.go
@@ -13,7 +13,8 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
-func Int(v int) *int { return &v }
+func Int(v int) *int    { return &v }
+func Bool(v bool) *bool { return &v }
 
 func TestDefaultRule(t *testing.T) {
 	testCases := []struct {
@@ -64,7 +65,7 @@ func TestDefaultRule(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -113,7 +114,7 @@ func TestDefaultRule(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -164,7 +165,7 @@ func TestDefaultRule(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -208,7 +209,7 @@ func TestDefaultRule(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -252,7 +253,7 @@ func TestDefaultRule(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -301,7 +302,7 @@ func TestDefaultRule(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -384,7 +385,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -452,7 +453,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Test2": {
@@ -462,7 +463,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -531,7 +532,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -581,7 +582,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -633,7 +634,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -677,7 +678,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -734,7 +735,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -781,7 +782,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Service2": {
@@ -791,7 +792,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -842,7 +843,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1052,7 +1053,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1101,7 +1102,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1193,7 +1194,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1266,7 +1267,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1361,7 +1362,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.3:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1429,7 +1430,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1519,7 +1520,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.3:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1592,7 +1593,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1655,7 +1656,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Test2": {
@@ -1665,7 +1666,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1715,7 +1716,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1766,7 +1767,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "h2c://127.0.0.1:8080",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1812,7 +1813,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Service2": {
@@ -1822,7 +1823,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:8080",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -2037,7 +2038,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -2098,7 +2099,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -2348,7 +2349,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
diff --git a/pkg/provider/kubernetes/crd/kubernetes_test.go b/pkg/provider/kubernetes/crd/kubernetes_test.go
index 28c04d5d8..142a99576 100644
--- a/pkg/provider/kubernetes/crd/kubernetes_test.go
+++ b/pkg/provider/kubernetes/crd/kubernetes_test.go
@@ -12,7 +12,8 @@ import (
 
 var _ provider.Provider = (*Provider)(nil)
 
-func Int(v int) *int { return &v }
+func Int(v int) *int    { return &v }
+func Bool(v bool) *bool { return &v }
 
 func TestLoadIngressRouteTCPs(t *testing.T) {
 	testCases := []struct {
@@ -737,7 +738,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -786,7 +787,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -836,7 +837,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -878,7 +879,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"default-test.route-77c62dfe9517144aeeaa": {
@@ -891,7 +892,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -943,7 +944,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"default-test.route-77c62dfe9517144aeeaa-whoami2-8080": {
@@ -956,7 +957,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.4:8080",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1007,7 +1008,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"default-test.route-77c62dfe9517144aeeaa-whoami2-8080": {
@@ -1020,7 +1021,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.4:8080",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1132,7 +1133,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1190,7 +1191,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1248,7 +1249,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1305,7 +1306,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1351,7 +1352,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1397,7 +1398,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1435,7 +1436,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1472,7 +1473,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "https://10.10.0.6:8443",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1509,7 +1510,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "https://10.10.0.8:8443",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1584,7 +1585,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1620,7 +1621,7 @@ func TestLoadIngressRoutes(t *testing.T) {
 										URL: "http://10.10.0.2:80",
 									},
 								},
-								PassHostHeader:     false,
+								PassHostHeader:     Bool(false),
 								ResponseForwarding: &dynamic.ResponseForwarding{FlushInterval: "10s"},
 							},
 						},
diff --git a/pkg/provider/kubernetes/ingress/kubernetes_test.go b/pkg/provider/kubernetes/ingress/kubernetes_test.go
index bcf2b0c13..76c02240d 100644
--- a/pkg/provider/kubernetes/ingress/kubernetes_test.go
+++ b/pkg/provider/kubernetes/ingress/kubernetes_test.go
@@ -19,6 +19,8 @@ import (
 
 var _ provider.Provider = (*Provider)(nil)
 
+func Bool(v bool) *bool { return &v }
+
 func TestLoadConfigurationFromIngresses(t *testing.T) {
 	testCases := []struct {
 		desc         string
@@ -51,7 +53,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -85,7 +87,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -119,7 +121,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -149,7 +151,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -178,7 +180,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-example-com-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.11.0.1:80",
@@ -209,7 +211,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -243,7 +245,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -277,7 +279,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -318,7 +320,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -363,7 +365,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -376,7 +378,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 						},
 						"testing-service2-8082": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.2:8080",
@@ -429,7 +431,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"default-backend": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
@@ -459,7 +461,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8089",
@@ -489,7 +491,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-tchouk": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8089",
@@ -519,7 +521,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-tchouk": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8089",
@@ -553,7 +555,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-tchouk": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8089",
@@ -566,7 +568,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 						},
 						"testing-service1-carotte": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8090",
@@ -600,7 +602,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-tchouk": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8089",
@@ -613,7 +615,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 						},
 						"toto-service1-tchouk": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.11.0.1:8089",
@@ -665,7 +667,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-8080": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://traefik.wtf:8080",
@@ -697,7 +699,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-example-com-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.11.0.1:80",
@@ -734,7 +736,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-443": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "https://10.10.0.1:8443",
@@ -764,7 +766,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-8443": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "https://10.10.0.1:8443",
@@ -795,7 +797,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-8443": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "https://10.10.0.1:8443",
@@ -826,7 +828,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"default-backend": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.30.0.1:8080",
@@ -856,7 +858,7 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
 					Services: map[string]*dynamic.Service{
 						"testing-service1-80": {
 							LoadBalancer: &dynamic.ServersLoadBalancer{
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 								Servers: []dynamic.Server{
 									{
 										URL: "http://10.10.0.1:8080",
diff --git a/pkg/provider/marathon/config_test.go b/pkg/provider/marathon/config_test.go
index 83c25736c..e0da93e6b 100644
--- a/pkg/provider/marathon/config_test.go
+++ b/pkg/provider/marathon/config_test.go
@@ -11,7 +11,8 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
-func Int(v int) *int { return &v }
+func Int(v int) *int    { return &v }
+func Bool(v bool) *bool { return &v }
 
 func TestGetConfigurationAPIErrors(t *testing.T) {
 	fakeClient := newFakeClient(true, marathon.Applications{})
@@ -64,7 +65,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:80",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 					},
 				},
@@ -118,7 +119,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:80",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 					},
 				},
@@ -164,7 +165,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:80",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 					},
 				},
@@ -211,7 +212,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:8081",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 					},
 				},
@@ -266,7 +267,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:8083",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 					},
 				},
@@ -308,7 +309,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:8080",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 						"bar": {LoadBalancer: &dynamic.ServersLoadBalancer{
 							Servers: []dynamic.Server{
@@ -316,7 +317,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:8081",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 					},
 				},
@@ -354,7 +355,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:81",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -390,7 +391,7 @@ func TestBuildConfiguration(t *testing.T) {
 									URL: "http://localhost:80",
 								},
 							},
-							PassHostHeader: true,
+							PassHostHeader: Bool(true),
 						}},
 					},
 				},
@@ -428,7 +429,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -459,7 +460,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -503,7 +504,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -537,7 +538,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Service2": {
@@ -547,7 +548,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -639,7 +640,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"app2": {
@@ -649,7 +650,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -696,7 +697,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"app2": {
@@ -706,7 +707,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -744,7 +745,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"app2": {
@@ -754,7 +755,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -802,7 +803,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -840,7 +841,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"app2": {
@@ -850,7 +851,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -887,7 +888,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -925,7 +926,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "h2c://localhost:90",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -958,7 +959,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Service2": {
@@ -968,7 +969,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:8080",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1133,7 +1134,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1171,7 +1172,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1208,7 +1209,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -1417,7 +1418,7 @@ func TestBuildConfiguration(t *testing.T) {
 										URL: "http://localhost:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
diff --git a/pkg/provider/rancher/config_test.go b/pkg/provider/rancher/config_test.go
index 0e771b190..aa20e87f0 100644
--- a/pkg/provider/rancher/config_test.go
+++ b/pkg/provider/rancher/config_test.go
@@ -9,7 +9,8 @@ import (
 	"github.com/stretchr/testify/require"
 )
 
-func Int(v int) *int { return &v }
+func Int(v int) *int    { return &v }
+func Bool(v bool) *bool { return &v }
 
 func Test_buildConfiguration(t *testing.T) {
 	testCases := []struct {
@@ -51,7 +52,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -103,7 +104,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Test2": {
@@ -113,7 +114,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -168,7 +169,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 						"Test2": {
@@ -178,7 +179,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://128.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -222,7 +223,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -310,7 +311,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -380,7 +381,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -433,7 +434,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -475,7 +476,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.1:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
@@ -667,7 +668,7 @@ func Test_buildConfiguration(t *testing.T) {
 										URL: "http://127.0.0.2:80",
 									},
 								},
-								PassHostHeader: true,
+								PassHostHeader: Bool(true),
 							},
 						},
 					},
diff --git a/pkg/server/service/proxy_test.go b/pkg/server/service/proxy_test.go
index 53d8b5d14..38966b509 100644
--- a/pkg/server/service/proxy_test.go
+++ b/pkg/server/service/proxy_test.go
@@ -28,7 +28,7 @@ func BenchmarkProxy(b *testing.B) {
 	req := testhelpers.MustNewRequest(http.MethodGet, "http://foo.bar/", nil)
 
 	pool := newBufferPool()
-	handler, _ := buildProxy(false, nil, &staticTransport{res}, pool, nil)
+	handler, _ := buildProxy(Bool(false), nil, &staticTransport{res}, pool, nil)
 
 	b.ReportAllocs()
 	for i := 0; i < b.N; i++ {
diff --git a/pkg/server/service/proxy_websocket_test.go b/pkg/server/service/proxy_websocket_test.go
index 1e4239cf9..bbb0d1196 100644
--- a/pkg/server/service/proxy_websocket_test.go
+++ b/pkg/server/service/proxy_websocket_test.go
@@ -17,8 +17,10 @@ import (
 	"golang.org/x/net/websocket"
 )
 
+func Bool(v bool) *bool { return &v }
+
 func TestWebSocketTCPClose(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	errChan := make(chan error, 1)
@@ -57,7 +59,7 @@ func TestWebSocketTCPClose(t *testing.T) {
 }
 
 func TestWebSocketPingPong(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 
 	require.NoError(t, err)
 
@@ -123,7 +125,7 @@ func TestWebSocketPingPong(t *testing.T) {
 }
 
 func TestWebSocketEcho(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	mux := http.NewServeMux()
@@ -189,7 +191,7 @@ func TestWebSocketPassHost(t *testing.T) {
 
 	for _, test := range testCases {
 		t.Run(test.desc, func(t *testing.T) {
-			f, err := buildProxy(test.passHost, nil, http.DefaultTransport, nil, nil)
+			f, err := buildProxy(Bool(test.passHost), nil, http.DefaultTransport, nil, nil)
 
 			require.NoError(t, err)
 
@@ -248,7 +250,7 @@ func TestWebSocketPassHost(t *testing.T) {
 }
 
 func TestWebSocketServerWithoutCheckOrigin(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	upgrader := gorillawebsocket.Upgrader{CheckOrigin: func(r *http.Request) bool {
@@ -289,7 +291,7 @@ func TestWebSocketServerWithoutCheckOrigin(t *testing.T) {
 }
 
 func TestWebSocketRequestWithOrigin(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	upgrader := gorillawebsocket.Upgrader{}
@@ -335,7 +337,7 @@ func TestWebSocketRequestWithOrigin(t *testing.T) {
 }
 
 func TestWebSocketRequestWithQueryParams(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	upgrader := gorillawebsocket.Upgrader{}
@@ -375,7 +377,7 @@ func TestWebSocketRequestWithQueryParams(t *testing.T) {
 }
 
 func TestWebSocketRequestWithHeadersInResponseWriter(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	mux := http.NewServeMux()
@@ -407,7 +409,7 @@ func TestWebSocketRequestWithHeadersInResponseWriter(t *testing.T) {
 }
 
 func TestWebSocketRequestWithEncodedChar(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	upgrader := gorillawebsocket.Upgrader{}
@@ -447,7 +449,7 @@ func TestWebSocketRequestWithEncodedChar(t *testing.T) {
 }
 
 func TestWebSocketUpgradeFailed(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	mux := http.NewServeMux()
@@ -497,7 +499,7 @@ func TestWebSocketUpgradeFailed(t *testing.T) {
 }
 
 func TestForwardsWebsocketTraffic(t *testing.T) {
-	f, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	f, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	mux := http.NewServeMux()
@@ -553,7 +555,7 @@ func TestWebSocketTransferTLSConfig(t *testing.T) {
 	srv := createTLSWebsocketServer()
 	defer srv.Close()
 
-	forwarderWithoutTLSConfig, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	forwarderWithoutTLSConfig, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	proxyWithoutTLSConfig := createProxyWithForwarder(t, forwarderWithoutTLSConfig, srv.URL)
@@ -572,7 +574,7 @@ func TestWebSocketTransferTLSConfig(t *testing.T) {
 	transport := &http.Transport{
 		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
 	}
-	forwarderWithTLSConfig, err := buildProxy(true, nil, transport, nil, nil)
+	forwarderWithTLSConfig, err := buildProxy(Bool(true), nil, transport, nil, nil)
 	require.NoError(t, err)
 
 	proxyWithTLSConfig := createProxyWithForwarder(t, forwarderWithTLSConfig, srv.URL)
@@ -591,7 +593,7 @@ func TestWebSocketTransferTLSConfig(t *testing.T) {
 
 	http.DefaultTransport.(*http.Transport).TLSClientConfig = &tls.Config{InsecureSkipVerify: true}
 
-	forwarderWithTLSConfigFromDefaultTransport, err := buildProxy(true, nil, http.DefaultTransport, nil, nil)
+	forwarderWithTLSConfigFromDefaultTransport, err := buildProxy(Bool(true), nil, http.DefaultTransport, nil, nil)
 	require.NoError(t, err)
 
 	proxyWithTLSConfigFromDefaultTransport := createProxyWithForwarder(t, forwarderWithTLSConfigFromDefaultTransport, srv.URL)
diff --git a/pkg/server/service/service_test.go b/pkg/server/service/service_test.go
index 1c2cdbf8c..6090266c0 100644
--- a/pkg/server/service/service_test.go
+++ b/pkg/server/service/service_test.go
@@ -221,7 +221,7 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) {
 			serviceName: "test",
 			service: &dynamic.ServersLoadBalancer{
 				Sticky:         &dynamic.Sticky{Cookie: &dynamic.Cookie{}},
-				PassHostHeader: true,
+				PassHostHeader: func(v bool) *bool { return &v }(true),
 				Servers: []dynamic.Server{
 					{
 						URL: serverPassHost.URL,
@@ -239,7 +239,8 @@ func TestGetLoadBalancerServiceHandler(t *testing.T) {
 			desc:        "PassHost doesn't passe the host instead of the IP",
 			serviceName: "test",
 			service: &dynamic.ServersLoadBalancer{
-				Sticky: &dynamic.Sticky{Cookie: &dynamic.Cookie{}},
+				PassHostHeader: Bool(false),
+				Sticky:         &dynamic.Sticky{Cookie: &dynamic.Cookie{}},
 				Servers: []dynamic.Server{
 					{
 						URL: serverPassHostFalse.URL,