diff --git a/manifests/loadbalancer.pp b/manifests/loadbalancer.pp index ba3c64b1..ae25cb5d 100644 --- a/manifests/loadbalancer.pp +++ b/manifests/loadbalancer.pp @@ -245,9 +245,16 @@ class cloud::loadbalancer( 'balance' => 'leastconn' } } else { $horizon_httpchk = "httpchk GET /${horizon_auth_url} \"HTTP/1.0\\r\\nUser-Agent: HAproxy-${::hostname}\"" - $horizon_options = { + if 'ssl' in $horizon_bind_options { + $horizon_options = { + 'cookie' => 'sessionid prefix', + 'reqadd' => 'X-Forwarded-Proto:\ https if { ssl_fc }', + 'balance' => 'leastconn' } + } else { + $horizon_options = { 'cookie' => 'sessionid prefix', 'balance' => 'leastconn' } + } } if $horizon_ssl_port { warning('horizon_ssl_port parameter is deprecated. Specify port with the horizon_port instead.') diff --git a/spec/classes/cloud_loadbalancer_spec.rb b/spec/classes/cloud_loadbalancer_spec.rb index 602c27a5..42ee6e28 100644 --- a/spec/classes/cloud_loadbalancer_spec.rb +++ b/spec/classes/cloud_loadbalancer_spec.rb @@ -393,6 +393,7 @@ describe 'cloud::loadbalancer' do 'option' => ["tcpka", "forwardfor", "tcplog", "httpchk GET / \"HTTP/1.0\\r\\nUser-Agent: HAproxy-myhost\""], 'cookie' => 'sessionid prefix', 'balance' => 'leastconn', + 'reqadd' => 'X-Forwarded-Proto:\ https if { ssl_fc }' }, :bind_options => ['ssl', 'crt'] )}