From c0f43c2c5f6bd21d258063cb0559daf90c960412 Mon Sep 17 00:00:00 2001 From: Jeremy Liu Date: Sun, 16 Oct 2016 23:23:54 +0800 Subject: [PATCH] Use http_proxy_to_wsgi middleware This sets up the HTTPProxyToWSGI middleware in front of Sahara. The purpose of this middleware is to set up the request URL correctly in case there is a proxy (For instance, a loadbalancer such as HAProxy) in front of Sahara. The HTTPProxyToWSGI is off by default and needs to be enabled via a configuration value. Change-Id: Ica7e8671e3880c0db90d382bec89b0994f75b36d Closes-bug: #1590608 --- etc/sahara/api-paste.ini | 5 ++++- tools/config/config-generator.sahara.conf | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/etc/sahara/api-paste.ini b/etc/sahara/api-paste.ini index 5601274b..75fb01df 100644 --- a/etc/sahara/api-paste.ini +++ b/etc/sahara/api-paste.ini @@ -1,5 +1,5 @@ [pipeline:sahara] -pipeline = cors request_id acl auth_validator sahara_api +pipeline = cors http_proxy_to_wsgi request_id acl auth_validator sahara_api [composite:sahara_api] use = egg:Paste#urlmap @@ -31,3 +31,6 @@ paste.filter_factory = sahara.api.middleware.auth_valid:AuthValidator.factory [filter:debug] paste.filter_factory = oslo_middleware.debug:Debug.factory + +[filter:http_proxy_to_wsgi] +paste.filter_factory = oslo_middleware:HTTPProxyToWSGI.factory diff --git a/tools/config/config-generator.sahara.conf b/tools/config/config-generator.sahara.conf index 1d6b0fbe..b0ad3a13 100644 --- a/tools/config/config-generator.sahara.conf +++ b/tools/config/config-generator.sahara.conf @@ -7,6 +7,7 @@ namespace = oslo.db namespace = oslo.log namespace = oslo.messaging namespace = oslo.middleware.cors +namespace = oslo.middleware.http_proxy_to_wsgi namespace = oslo.policy namespace = oslo.service.periodic_task namespace = oslo.service.sslutils