Add enable_proxy_headers_parsing option

This option determines if the middleware should parse the
headers or not. Can be used in case if application is
behind the reverse proxy.

Change-Id: I22deb886706fe71115a04fb52a7051be4783a5c4
Related-bug: #1576740
This commit is contained in:
Mykyta Karpin 2016-05-18 17:40:30 +03:00
parent 881701c415
commit 9f1b261c82
2 changed files with 48 additions and 35 deletions

View File

@ -136,6 +136,11 @@
# (optional) Enable or not Nova API v3
# Defaults to false
#
# [*enable_proxy_headers_parsing*]
# (optional) This determines if the HTTPProxyToWSGI
# middleware should parse the proxy headers or not.(boolean value)
# Defaults to $::os_service_default
#
# [*default_floating_pool*]
# (optional) Default pool for floating IPs
# Defaults to 'nova'
@ -205,6 +210,7 @@ class nova::api(
$instance_name_template = undef,
$fping_path = '/usr/sbin/fping',
$service_name = $::nova::params::api_service_name,
$enable_proxy_headers_parsing = $::os_service_default,
# DEPRECATED PARAMETER
$conductor_workers = undef,
$ec2_listen_port = undef,
@ -311,6 +317,10 @@ class nova::api(
'osapi_v3/enabled': value => $osapi_v3;
}
oslo::middleware {'nova_config':
enable_proxy_headers_parsing => $enable_proxy_headers_parsing,
}
if ($neutron_metadata_proxy_shared_secret){
nova_config {
'neutron/service_metadata_proxy': value => true;

View File

@ -66,6 +66,7 @@ describe 'nova::api' do
is_expected.to contain_nova_config('DEFAULT/metadata_workers').with('value' => '5')
is_expected.to contain_nova_config('DEFAULT/default_floating_pool').with('value' => 'nova')
is_expected.to contain_nova_config('DEFAULT/fping_path').with('value' => '/usr/sbin/fping')
is_expected.to contain_nova_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => '<SERVICE DEFAULT>')
end
it 'do not configure v3 api' do
@ -100,7 +101,8 @@ describe 'nova::api' do
:metadata_workers => 2,
:default_floating_pool => 'public',
:osapi_v3 => true,
:pci_alias => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\",\"name\":\"graphic_card\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"name\":\"network_card\"}]"
:pci_alias => "[{\"vendor_id\":\"8086\",\"product_id\":\"0126\",\"name\":\"graphic_card\"},{\"vendor_id\":\"9096\",\"product_id\":\"1520\",\"name\":\"network_card\"}]",
:enable_proxy_headers_parsing => true
})
end
@ -146,6 +148,7 @@ describe 'nova::api' do
is_expected.to contain_nova_config('DEFAULT/default_floating_pool').with('value' => 'public')
is_expected.to contain_nova_config('neutron/service_metadata_proxy').with('value' => true)
is_expected.to contain_nova_config('neutron/metadata_proxy_shared_secret').with('value' => 'secrete')
is_expected.to contain_nova_config('oslo_middleware/enable_proxy_headers_parsing').with('value' => true)
end
it 'configure nova api v3' do