Add enable_proxy_headers_parsing option

The patch enables paste middleware to handle SSL requests through
HTTPProxyToWSGI middleware.

Change-Id: Ifbed564e234303a4abbc5d2a90266c8c34e6516c
This commit is contained in:
ZhongShengping 2016-10-28 20:19:16 +08:00
parent e72ae32c08
commit a891cba1ae
3 changed files with 24 additions and 0 deletions

View File

@ -45,6 +45,11 @@
# to make mistral-api be a web app using apache mod_wsgi.
# Defaults to '$::mistral::params::api_service_name'
#
# [*enable_proxy_headers_parsing*]
# (Optional) Enable paste middleware to handle SSL requests through
# HTTPProxyToWSGI middleware.
# Defaults to $::os_service_default.
#
class mistral::api (
$allow_action_execution_deletion = $::os_service_default,
$api_workers = $::os_workers,
@ -54,6 +59,7 @@ class mistral::api (
$manage_service = true,
$package_ensure = present,
$service_name = $::mistral::params::api_service_name,
$enable_proxy_headers_parsing = $::os_service_default,
) inherits mistral::params {
include ::mistral::params
@ -113,4 +119,8 @@ as a standalone service, or httpd for being run by a httpd server")
'api/allow_action_execution_deletion' : value => $allow_action_execution_deletion;
}
oslo::middleware { 'mistral_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
}
}

View File

@ -0,0 +1,4 @@
---
features:
- This adds the enable_proxy_headers parsing option which is used by the
http_proxy_to_wsgi middleware.

View File

@ -8,6 +8,7 @@ describe 'mistral::api' do
:manage_service => true,
:bind_host => '127.0.0.1',
:bind_port => '1234',
:enable_proxy_headers_parsing => false,
:allow_action_execution_deletion => false}
end
@ -21,6 +22,7 @@ describe 'mistral::api' do
it { is_expected.to contain_mistral_config('api/api_workers').with_value( params[:api_workers] ) }
it { is_expected.to contain_mistral_config('api/host').with_value( params[:bind_host] ) }
it { is_expected.to contain_mistral_config('api/port').with_value( params[:bind_port] ) }
it { is_expected.to contain_mistral_config('oslo_middleware/enable_proxy_headers_parsing').with_value( params[:enable_proxy_headers_parsing] ) }
it { is_expected.to contain_mistral_config('api/allow_action_execution_deletion').with_value( params[:allow_action_execution_deletion] ) }
end
@ -46,6 +48,14 @@ describe 'mistral::api' do
end
end
context 'with enable_proxy_headers_parsing' do
before do
params.merge!({:enable_proxy_headers_parsing => true })
end
it { is_expected.to contain_mistral_config('oslo_middleware/enable_proxy_headers_parsing').with_value( params[:enable_proxy_headers_parsing] ) }
end
context 'with disabled service managing' do
before do
params.merge!({