Add http_proxy_to_wsgi to api-paste

This sets up the HTTPProxyToWSGI middleware in front of Gnocchi. The
purpose of thise 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 Gnocchi.

So, for instance, when TLS connections are being terminated in the
proxy, and one tries to get the versions from the / resource of
Gnocchi, one will notice that the protocol is incorrect; It will show
'http' instead of 'https'. So this middleware handles such cases.
Thus helping Keystone discovery work correctly.

The HTTPProxyToWSGI is off by default and needs to be enabled via a
configuration value.

Change-Id: Ic5526cf37e70335fa2cc70946a271253f227f129
Closes-Bug: #1590608
This commit is contained in:
Juan Antonio Osorio Robles 2016-10-10 09:16:45 +03:00
parent 5186bcc6ba
commit 2b1ed8d452
1 changed files with 11 additions and 4 deletions

View File

@ -4,19 +4,22 @@ pipeline = gnocchi+noauth
[composite:gnocchi+noauth]
use = egg:Paste#urlmap
/ = gnocchiversions
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+noauth
[composite:gnocchi+auth]
use = egg:Paste#urlmap
/ = gnocchiversions
/ = gnocchiversions_pipeline
/v1 = gnocchiv1+auth
[pipeline:gnocchiv1+noauth]
pipeline = gnocchiv1
pipeline = http_proxy_to_wsgi gnocchiv1
[pipeline:gnocchiv1+auth]
pipeline = keystone_authtoken gnocchiv1
pipeline = http_proxy_to_wsgi keystone_authtoken gnocchiv1
[pipeline:gnocchiversions_pipeline]
pipeline = http_proxy_to_wsgi gnocchiversions
[app:gnocchiversions]
paste.app_factory = gnocchi.rest.app:app_factory
@ -29,3 +32,7 @@ root = gnocchi.rest.V1Controller
[filter:keystone_authtoken]
paste.filter_factory = keystonemiddleware.auth_token:filter_factory
oslo_config_project = gnocchi
[filter:http_proxy_to_wsgi]
paste.filter_factory = oslo_middleware.http_proxy_to_wsgi:HTTPProxyToWSGI.factory
oslo_config_project = gnocchi