diff --git a/manifests/wsgi/apache.pp b/manifests/wsgi/apache.pp index b768034..45e76dd 100644 --- a/manifests/wsgi/apache.pp +++ b/manifests/wsgi/apache.pp @@ -78,13 +78,21 @@ # The error log file name for the virtualhost. # Optional. Defaults to undef. # -# [*custom_wsgi_process_options*] -# (optional) gives you the oportunity to add custom process options or to -# overwrite the default options for the WSGI main process. -# eg. to use a virtual python environment for the WSGI process -# you could set it to: -# { python-path => '/my/python/virtualenv' } -# Defaults to {} +# [*custom_wsgi_process_options*] +# (optional) gives you the oportunity to add custom process options or to +# overwrite the default options for the WSGI main process. +# eg. to use a virtual python environment for the WSGI process +# you could set it to: +# { python-path => '/my/python/virtualenv' } +# Defaults to {} +# +# [*headers*] +# (optional) Headers for the vhost. +# Defaults to undef +# +# [*request_headers*] +# (optional) Modifies collected request headers in various ways. +# Defaults to undef # # == Dependencies # @@ -117,6 +125,8 @@ class zaqar::wsgi::apache ( $access_log_format = false, $error_log_file = undef, $custom_wsgi_process_options = {}, + $headers = undef, + $request_headers = undef, ) { include zaqar::deps @@ -148,6 +158,8 @@ class zaqar::wsgi::apache ( wsgi_script_dir => $::zaqar::params::zaqar_wsgi_script_path, wsgi_script_file => 'zaqar-server', wsgi_script_source => $::zaqar::params::zaqar_wsgi_script_source, + headers => $headers, + request_headers => $request_headers, vhost_custom_fragment => 'WSGICallableObject app', access_log_file => $access_log_file, access_log_format => $access_log_format, diff --git a/releasenotes/notes/apache-headers-80960700e9e63f0f.yaml b/releasenotes/notes/apache-headers-80960700e9e63f0f.yaml new file mode 100644 index 0000000..da5306d --- /dev/null +++ b/releasenotes/notes/apache-headers-80960700e9e63f0f.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The ``zaqar::wsgi::apache`` class now supports customizing + request/response headers added by apache. diff --git a/spec/classes/zaqar_wsgi_apache_spec.rb b/spec/classes/zaqar_wsgi_apache_spec.rb index 30eb1d1..ca4d47e 100644 --- a/spec/classes/zaqar_wsgi_apache_spec.rb +++ b/spec/classes/zaqar_wsgi_apache_spec.rb @@ -40,6 +40,8 @@ describe 'zaqar::wsgi::apache' do :custom_wsgi_process_options => { 'python_path' => '/my/python/path', }, + :headers => ['set X-XSS-Protection "1; mode=block"'], + :request_headers => ['set Content-Type "application/json"'], } end it { is_expected.to contain_class('zaqar::params') } @@ -59,12 +61,14 @@ describe 'zaqar::wsgi::apache' do :wsgi_script_dir => platform_params[:wsgi_script_path], :wsgi_script_file => 'zaqar-server', :wsgi_script_source => platform_params[:wsgi_script_source], - :access_log_file => '/var/log/httpd/access_log', - :access_log_format => 'some format', - :error_log_file => '/var/log/httpd/error_log', + :headers => ['set X-XSS-Protection "1; mode=block"'], + :request_headers => ['set Content-Type "application/json"'], :custom_wsgi_process_options => { 'python_path' => '/my/python/path', }, + :access_log_file => '/var/log/httpd/access_log', + :access_log_format => 'some format', + :error_log_file => '/var/log/httpd/error_log', )} end end