From def1adb6b41a53a77e866cce37ce513745553bda Mon Sep 17 00:00:00 2001
From: Jeffrey Zhang <zhang.lei.fly@gmail.com>
Date: Wed, 24 Jan 2018 18:28:06 +0800
Subject: [PATCH] Fix the ssl issue for placement api when enabled ssl

Change-Id: I43db3048f92207da5ec3a2b9ed52b4c4083c3881
Closes-Bug: #1745128
---
 ansible/roles/haproxy/templates/haproxy.cfg.j2 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2
index 24a08f78d9..f0f4d89866 100644
--- a/ansible/roles/haproxy/templates/haproxy.cfg.j2
+++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2
@@ -139,7 +139,7 @@ listen nova_metadata
 
 listen placement_api
   bind {{ kolla_internal_vip_address }}:{{ placement_api_port }}
-  http-request del-header X-Forwarded-Proto
+  http-request del-header X-Forwarded-Proto if { ssl_fc }
 {% for host in groups['placement-api'] %}
   server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ placement_api_port }} check inter 2000 rise 2 fall 5
 {% endfor %}
@@ -192,8 +192,8 @@ listen nova_metadata_external
 {% endfor %}
 
 listen placement_api_external
-  bind {{ kolla_external_vip_address }}:{{ placement_api_port }}
-  http-request del-header X-Forwarded-Proto
+  bind {{ kolla_external_vip_address }}:{{ placement_api_port }} {{ tls_bind_info }}
+  http-request del-header X-Forwarded-Proto if { ssl_fc }
   http-request set-header X-Forwarded-Proto https if { ssl_fc }
 {% for host in groups['placement-api'] %}
   server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ placement_api_port }} check inter 2000 rise 2 fall 5