Support [DEFAULT] cors_expose_headers
... so that all options rleated to CORS can be customized. Change-Id: If93fc6b7c16afb5e422f2e7cc6063769d9ce46fe
This commit is contained in:
@@ -123,15 +123,20 @@
|
|||||||
# Configures log_name for swift proxy-server.
|
# Configures log_name for swift proxy-server.
|
||||||
# Optional. Defaults to proxy-server
|
# Optional. Defaults to proxy-server
|
||||||
#
|
#
|
||||||
# [*cors_allow_origin*]
|
# [*cors_allow_origin*]
|
||||||
# (optional) Origins to be allowed to make Cross Origin Requests.
|
# (optional) Origins to be allowed to make Cross Origin Requests.
|
||||||
# A comma separated list of full url (http://foo.bar:1234,https://foo.bar)
|
# A comma separated list of full url (http://foo.bar:1234,https://foo.bar)
|
||||||
# Defaults to $facts['os_service_default'].
|
# Defaults to $facts['os_service_default'].
|
||||||
#
|
#
|
||||||
# [*strict_cors_mode*]
|
# [*strict_cors_mode*]
|
||||||
# (optional) If True (default) then CORS requests are only allowed if their
|
# (optional) If True (default) then CORS requests are only allowed if their
|
||||||
# Origin header matches an allowed origin. Otherwise, any Origin is allowed.
|
# Origin header matches an allowed origin. Otherwise, any Origin is allowed.
|
||||||
# Defaults to $facts['os_service_default'].
|
# Defaults to $facts['os_service_default'].
|
||||||
|
#
|
||||||
|
# [*cors_expose_headers*]
|
||||||
|
# (optional) List of headers to expose through Access-Control-Expose-Headers,
|
||||||
|
# in addition to the defaults and any headers set in container metadata.
|
||||||
|
# Defaults to $facts['os_service_default'].
|
||||||
#
|
#
|
||||||
# [*service_provider*]
|
# [*service_provider*]
|
||||||
# (optional)
|
# (optional)
|
||||||
@@ -173,6 +178,7 @@ class swift::proxy(
|
|||||||
$log_name = 'proxy-server',
|
$log_name = 'proxy-server',
|
||||||
$cors_allow_origin = $facts['os_service_default'],
|
$cors_allow_origin = $facts['os_service_default'],
|
||||||
$strict_cors_mode = $facts['os_service_default'],
|
$strict_cors_mode = $facts['os_service_default'],
|
||||||
|
$cors_expose_headers = $facts['os_service_default'],
|
||||||
$object_chunk_size = $facts['os_service_default'],
|
$object_chunk_size = $facts['os_service_default'],
|
||||||
$client_chunk_size = $facts['os_service_default'],
|
$client_chunk_size = $facts['os_service_default'],
|
||||||
$max_containers_per_account = $facts['os_service_default'],
|
$max_containers_per_account = $facts['os_service_default'],
|
||||||
@@ -267,8 +273,9 @@ class swift::proxy(
|
|||||||
}
|
}
|
||||||
|
|
||||||
swift_proxy_config {
|
swift_proxy_config {
|
||||||
'DEFAULT/cors_allow_origin': value => join(any2array($cors_allow_origin), ',');
|
'DEFAULT/cors_allow_origin': value => join(any2array($cors_allow_origin), ',');
|
||||||
'DEFAULT/strict_cors_mode': value => $strict_cors_mode;
|
'DEFAULT/strict_cors_mode': value => $strict_cors_mode;
|
||||||
|
'DEFAULT/cors_expose_headers': value => join(any2array($cors_expose_headers), ',');
|
||||||
}
|
}
|
||||||
|
|
||||||
if $write_affinity {
|
if $write_affinity {
|
||||||
|
@@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
The new ``swift::proxy::cors_expose_headers`` parameter has been added.
|
@@ -89,6 +89,7 @@ describe 'swift::proxy' do
|
|||||||
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('<SERVICE DEFAULT>') }
|
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('<SERVICE DEFAULT>') }
|
||||||
it { should contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('<SERVICE DEFAULT>') }
|
it { should contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('<SERVICE DEFAULT>') }
|
||||||
it { should contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('<SERVICE DEFAULT>') }
|
it { should contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('<SERVICE DEFAULT>') }
|
||||||
|
it { should contain_swift_proxy_config('DEFAULT/cors_expose_headers').with_value('<SERVICE DEFAULT>') }
|
||||||
|
|
||||||
it { should contain_service('swift-proxy-server').with_require([
|
it { should contain_service('swift-proxy-server').with_require([
|
||||||
'Class[Swift::Proxy::Catch_errors]',
|
'Class[Swift::Proxy::Catch_errors]',
|
||||||
@@ -150,7 +151,8 @@ describe 'swift::proxy' do
|
|||||||
:node_timeout => '20',
|
:node_timeout => '20',
|
||||||
:recoverable_node_timeout => '15',
|
:recoverable_node_timeout => '15',
|
||||||
:cors_allow_origin => ['http://foo.bar:1234', 'https://foo.bar'],
|
:cors_allow_origin => ['http://foo.bar:1234', 'https://foo.bar'],
|
||||||
:strict_cors_mode => true
|
:strict_cors_mode => true,
|
||||||
|
:cors_expose_headers => ['header-a', 'header-b'],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -186,6 +188,7 @@ describe 'swift::proxy' do
|
|||||||
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('15') }
|
it { should contain_swift_proxy_config('app:proxy-server/recoverable_node_timeout').with_value('15') }
|
||||||
it { should contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('http://foo.bar:1234,https://foo.bar') }
|
it { should contain_swift_proxy_config('DEFAULT/cors_allow_origin').with_value('http://foo.bar:1234,https://foo.bar') }
|
||||||
it { should contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('true') }
|
it { should contain_swift_proxy_config('DEFAULT/strict_cors_mode').with_value('true') }
|
||||||
|
it { should contain_swift_proxy_config('DEFAULT/cors_expose_headers').with_value('header-a,header-b') }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "when log udp port is set" do
|
describe "when log udp port is set" do
|
||||||
|
Reference in New Issue
Block a user