Expose headers option of apache::vhost
The headers option in apache::vhost is required in some case, for example when adding the X-XSS-Protection header. This change allows customizing the option for the api vhost. This change also adds support for request_headers so that both request headers and response headers can customized. Change-Id: Ie5f2669a8686a3546b652251881615e0e18bf433
This commit is contained in:
parent
ff956c7a5b
commit
5d3e8252d6
@ -78,13 +78,21 @@
|
|||||||
# The error log file name for the virtualhost.
|
# The error log file name for the virtualhost.
|
||||||
# Optional. Defaults to undef.
|
# Optional. Defaults to undef.
|
||||||
#
|
#
|
||||||
# [*custom_wsgi_process_options*]
|
# [*custom_wsgi_process_options*]
|
||||||
# (optional) gives you the oportunity to add custom process options or to
|
# (optional) gives you the oportunity to add custom process options or to
|
||||||
# overwrite the default options for the WSGI main process.
|
# overwrite the default options for the WSGI main process.
|
||||||
# eg. to use a virtual python environment for the WSGI process
|
# eg. to use a virtual python environment for the WSGI process
|
||||||
# you could set it to:
|
# you could set it to:
|
||||||
# { python-path => '/my/python/virtualenv' }
|
# { python-path => '/my/python/virtualenv' }
|
||||||
# Defaults to {}
|
# 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
|
# == Dependencies
|
||||||
#
|
#
|
||||||
@ -117,6 +125,8 @@ class zaqar::wsgi::apache (
|
|||||||
$access_log_format = false,
|
$access_log_format = false,
|
||||||
$error_log_file = undef,
|
$error_log_file = undef,
|
||||||
$custom_wsgi_process_options = {},
|
$custom_wsgi_process_options = {},
|
||||||
|
$headers = undef,
|
||||||
|
$request_headers = undef,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
include zaqar::deps
|
include zaqar::deps
|
||||||
@ -148,6 +158,8 @@ class zaqar::wsgi::apache (
|
|||||||
wsgi_script_dir => $::zaqar::params::zaqar_wsgi_script_path,
|
wsgi_script_dir => $::zaqar::params::zaqar_wsgi_script_path,
|
||||||
wsgi_script_file => 'zaqar-server',
|
wsgi_script_file => 'zaqar-server',
|
||||||
wsgi_script_source => $::zaqar::params::zaqar_wsgi_script_source,
|
wsgi_script_source => $::zaqar::params::zaqar_wsgi_script_source,
|
||||||
|
headers => $headers,
|
||||||
|
request_headers => $request_headers,
|
||||||
vhost_custom_fragment => 'WSGICallableObject app',
|
vhost_custom_fragment => 'WSGICallableObject app',
|
||||||
access_log_file => $access_log_file,
|
access_log_file => $access_log_file,
|
||||||
access_log_format => $access_log_format,
|
access_log_format => $access_log_format,
|
||||||
|
5
releasenotes/notes/apache-headers-80960700e9e63f0f.yaml
Normal file
5
releasenotes/notes/apache-headers-80960700e9e63f0f.yaml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The ``zaqar::wsgi::apache`` class now supports customizing
|
||||||
|
request/response headers added by apache.
|
@ -40,6 +40,8 @@ describe 'zaqar::wsgi::apache' do
|
|||||||
:custom_wsgi_process_options => {
|
:custom_wsgi_process_options => {
|
||||||
'python_path' => '/my/python/path',
|
'python_path' => '/my/python/path',
|
||||||
},
|
},
|
||||||
|
:headers => ['set X-XSS-Protection "1; mode=block"'],
|
||||||
|
:request_headers => ['set Content-Type "application/json"'],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
it { is_expected.to contain_class('zaqar::params') }
|
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_dir => platform_params[:wsgi_script_path],
|
||||||
:wsgi_script_file => 'zaqar-server',
|
:wsgi_script_file => 'zaqar-server',
|
||||||
:wsgi_script_source => platform_params[:wsgi_script_source],
|
:wsgi_script_source => platform_params[:wsgi_script_source],
|
||||||
:access_log_file => '/var/log/httpd/access_log',
|
:headers => ['set X-XSS-Protection "1; mode=block"'],
|
||||||
:access_log_format => 'some format',
|
:request_headers => ['set Content-Type "application/json"'],
|
||||||
:error_log_file => '/var/log/httpd/error_log',
|
|
||||||
:custom_wsgi_process_options => {
|
:custom_wsgi_process_options => {
|
||||||
'python_path' => '/my/python/path',
|
'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
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user