diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index 4732ad44..64fff969 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -93,6 +93,10 @@ # (optional) Name of the WSGI process display-name. # Defaults to undef # +# [*request_headers*] +# (optional) Modifies collected request headers in various ways. +# Defaults to undef +# # == Dependencies # # requires Class['apache'] & Class['heat'] @@ -125,6 +129,7 @@ define heat::wsgi::apache ( $error_log_file = undef, $custom_wsgi_process_options = {}, $wsgi_process_display_name = undef, + $request_headers = undef, ) { if $title !~ /^api(|_cfn)$/ { fail('The valid options are api, api_cfn') @@ -174,5 +179,6 @@ define heat::wsgi::apache ( access_log_file => $access_log_file, access_log_format => $access_log_format, error_log_file => $error_log_file, + request_headers => $request_headers, } } diff --git a/manifests/wsgi/apache_api.pp b/manifests/wsgi/apache_api.pp index 9219204a..2ac6ee8b 100644 --- a/manifests/wsgi/apache_api.pp +++ b/manifests/wsgi/apache_api.pp @@ -89,6 +89,10 @@ # (optional) Additional vhost configuration, if applicable. # Defaults to undef # +# [*request_headers*] +# (optional) Modifies collected request headers in various ways. +# Defaults to undef +# # == Dependencies # # requires Class['apache'] & Class['heat'] @@ -121,6 +125,7 @@ class heat::wsgi::apache_api ( $custom_wsgi_process_options = {}, $wsgi_process_display_name = undef, $vhost_custom_fragment = undef, + $request_headers = undef, ) { if $ssl == undef { @@ -150,5 +155,6 @@ class heat::wsgi::apache_api ( error_log_file => $error_log_file, wsgi_process_display_name => $wsgi_process_display_name, vhost_custom_fragment => $vhost_custom_fragment, + request_headers => $request_headers, } } diff --git a/manifests/wsgi/apache_api_cfn.pp b/manifests/wsgi/apache_api_cfn.pp index d23ec514..f211aee5 100644 --- a/manifests/wsgi/apache_api_cfn.pp +++ b/manifests/wsgi/apache_api_cfn.pp @@ -88,7 +88,11 @@ # [*vhost_custom_fragment*] # (optional) Passes a string of custom configuration # directives to be placed at the end of the vhost configuration. -# Default: 'RequestHeader set Content-Type "application/json"' +# Defaults to undef +# +# [*request_headers*] +# (optional) Modifies collected request headers in various ways. +# Defaults to ['set Content-Type "application/json"'] # # == Dependencies # @@ -121,8 +125,9 @@ class heat::wsgi::apache_api_cfn ( $error_log_file = undef, $custom_wsgi_process_options = {}, $wsgi_process_display_name = undef, + $vhost_custom_fragment = undef, # Enforce content-type, see https://bugs.launchpad.net/tripleo/+bug/1641589 - $vhost_custom_fragment = 'RequestHeader set Content-Type "application/json"', + $request_headers = ['set Content-Type "application/json"'], ) { if $ssl == undef { @@ -130,10 +135,6 @@ class heat::wsgi::apache_api_cfn ( } $ssl_real = pick($ssl, true) - # See custom fragment below - include apache - include apache::mod::headers - validate_legacy(Integer, 'validate_integer', $port) # Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1396553 @@ -167,5 +168,6 @@ class heat::wsgi::apache_api_cfn ( access_log_format => $access_log_format, error_log_file => $error_log_file, wsgi_process_display_name => $wsgi_process_display_name, + request_headers => $request_headers, } } diff --git a/releasenotes/notes/apache-request_headers-fa752fc465ffad7a.yaml b/releasenotes/notes/apache-request_headers-fa752fc465ffad7a.yaml new file mode 100644 index 00000000..8bf23194 --- /dev/null +++ b/releasenotes/notes/apache-request_headers-fa752fc465ffad7a.yaml @@ -0,0 +1,13 @@ +--- +features: + - | + Now puppet-heat supports overiding ``RequestHeader`` statements in apache + vhost configuration. Use the new ``request_headers`` parameter to define + the configuration value. + +upgrade: + - | + Default value of ``heat::wsgi::apache_api_cfn::vhost_custom_fragment`` has + been updated to ``undef`` and now the new ``request_headers`` parameter + is used to define the default ``RequestHeader`` statement. Please update + these parameters accordingly. diff --git a/spec/classes/heat_wsgi_apache_api_cfn_spec.rb b/spec/classes/heat_wsgi_apache_api_cfn_spec.rb index beaa1733..b3c3bb1d 100644 --- a/spec/classes/heat_wsgi_apache_api_cfn_spec.rb +++ b/spec/classes/heat_wsgi_apache_api_cfn_spec.rb @@ -24,7 +24,8 @@ describe 'heat::wsgi::apache_api_cfn' do :custom_wsgi_process_options => {}, :access_log_file => false, :access_log_format => false, - :vhost_custom_fragment => 'RequestHeader set Content-Type "application/json"',) + :vhost_custom_fragment => nil, + :request_headers => ['set Content-Type "application/json"'],) } end end diff --git a/spec/defines/heat_wsgi_apache_spec.rb b/spec/defines/heat_wsgi_apache_spec.rb index 4e2adc9d..e12d7715 100644 --- a/spec/defines/heat_wsgi_apache_spec.rb +++ b/spec/defines/heat_wsgi_apache_spec.rb @@ -30,6 +30,7 @@ describe 'heat::wsgi::apache' do 'wsgi_script_dir' => platform_params[:wsgi_script_dir], 'wsgi_script_file' => "heat_#{title}", 'allow_encoded_slashes' => 'on', + 'request_headers' => nil, )} it { is_expected.to contain_concat("#{platform_params[:httpd_ports_file]}") } end