Enforce content type in CFN WSGI

This works around a bug in the config tools, not sending a type
properly.

Change-Id: I79b7b19d8c1af6cc34875fc05800dc9da5ac7cad
Related-Bug: #1641589
This commit is contained in:
Thomas Herve 2017-03-03 21:59:47 +01:00
parent 16c2e5aa73
commit f24b39c73a
2 changed files with 41 additions and 29 deletions

View File

@ -66,6 +66,9 @@
# apache::vhost ssl parameters.
# Optional. Default to apache::vhost 'ssl_*' defaults.
#
# [*vhost_custom_fragment*]
# (optional) Additional vhost configuration, if applicable.
#
# == Dependencies
#
# requires Class['apache'] & Class['heat']
@ -92,6 +95,7 @@ define heat::wsgi::apache (
$ssl_certs_dir = undef,
$threads = $::os_workers,
$priority = '10',
$vhost_custom_fragment = undef,
) {
if $title !~ /^api(|_cfn|_cloudwatch)$/ {
fail('The valid options are api, api_cfn, api_cloudwatch')
@ -129,5 +133,6 @@ define heat::wsgi::apache (
wsgi_script_source => getvar("::heat::params::heat_${title}_wsgi_script_source"),
allow_encoded_slashes => 'on',
require => Anchor['heat::install::end'],
vhost_custom_fragment => $vhost_custom_fragment,
}
}

View File

@ -89,6 +89,10 @@ class heat::wsgi::apache_api_cfn (
$priority = '10',
) {
# See custom fragment below
include ::apache
include ::apache::mod::headers
validate_integer($port)
# Workaround for https://bugzilla.redhat.com/show_bug.cgi?id=1396553
@ -99,6 +103,7 @@ class heat::wsgi::apache_api_cfn (
notify => Heat::Wsgi::Apache['api_cfn'],
}
}
heat::wsgi::apache { 'api_cfn':
port => $port,
servername => $servername,
@ -115,5 +120,7 @@ class heat::wsgi::apache_api_cfn (
ssl_certs_dir => $ssl_certs_dir,
threads => $threads,
priority => $priority,
# Enforce content-type, see https://bugs.launchpad.net/tripleo/+bug/1641589
vhost_custom_fragment => 'RequestHeader set Content-Type "application/json"',
}
}