From c0b7382df2ad09bd9f1281eb3e61bf206d2df7fd Mon Sep 17 00:00:00 2001 From: Patrick Uiterwijk Date: Thu, 10 Mar 2016 22:07:29 +0000 Subject: [PATCH] Allow to keep the host header through a setting Signed-off-by: Patrick Uiterwijk --- playbooks/include/proxies-reverseproxy.yml | 1 + roles/httpd/reverseproxy/tasks/main.yml | 1 + roles/httpd/reverseproxy/templates/reversepassproxy.conf | 5 +++++ roles/httpd/reverseproxy/vars/main.yml | 1 + 4 files changed, 8 insertions(+) diff --git a/playbooks/include/proxies-reverseproxy.yml b/playbooks/include/proxies-reverseproxy.yml index 4825f9bd6a..e029b30db7 100644 --- a/playbooks/include/proxies-reverseproxy.yml +++ b/playbooks/include/proxies-reverseproxy.yml @@ -455,6 +455,7 @@ destname: qa-stg-phab # Talk directly to the app server, not haproxy proxyurl: http://phab.qa-stg01.qa.fedoraproject.org + keephost: true when: env == "staging" - role: httpd/reverseproxy diff --git a/roles/httpd/reverseproxy/tasks/main.yml b/roles/httpd/reverseproxy/tasks/main.yml index c4fa7bb0c0..bb69f55c11 100644 --- a/roles/httpd/reverseproxy/tasks/main.yml +++ b/roles/httpd/reverseproxy/tasks/main.yml @@ -4,6 +4,7 @@ # - remotepath.. # - proxyurl # - rewrite +# - keephost - name: Copy in ProxyPassReverse for {{destname}} ({{website}}{{remotepath}}) template: > diff --git a/roles/httpd/reverseproxy/templates/reversepassproxy.conf b/roles/httpd/reverseproxy/templates/reversepassproxy.conf index 4304709d4c..b7d6ff06d0 100644 --- a/roles/httpd/reverseproxy/templates/reversepassproxy.conf +++ b/roles/httpd/reverseproxy/templates/reversepassproxy.conf @@ -9,5 +9,10 @@ RequestHeader set X-Scheme https early RequestHeader set X-Forwarded-Proto https early {% endif %} + +{% if keephost %} +ProxyPreserveHost On +{% endif %} + ProxyPass {{ localpath }} {{ proxyurl }}{{remotepath}} ProxyPassReverse {{ localpath }} {{ proxyurl }}{{remotepath}} diff --git a/roles/httpd/reverseproxy/vars/main.yml b/roles/httpd/reverseproxy/vars/main.yml index 61ee936ff3..751fac42b6 100644 --- a/roles/httpd/reverseproxy/vars/main.yml +++ b/roles/httpd/reverseproxy/vars/main.yml @@ -3,3 +3,4 @@ localpath: / destname: reversepassproxy rewrite: false header_scheme: false +keephost: false