Skip to content

Commit e7a38f3

Browse files
committed
Fixes #36854 - Use HTTP/2 when proxying to Foreman
This aims to use mod_proxy_http2, which utilizes HTTP/2 to a backend server. It depends on a feature released in puppetlabs-apache 10.1.1. Overall testing shows the connection is much more stable and reliable than with HTTP/1.1, especially in higher concurrency. It is recommended to keep this on, but there is an option to disable it if for some reason it doesn't work. In the future this same option can be used to support HTTP/3 when Apache implements that.
1 parent e359501 commit e7a38f3

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

manifests/init.pp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#
2727
# $reverse_proxy_port:: Reverse proxy listening port
2828
#
29+
# $reverse_proxy_backend_protocol:: Configure the protocol used by the reverse proxy to connect to Foreman
30+
#
2931
# $pulpcore_allowed_content_checksums:: List of checksums to use for pulpcore content operations
3032
#
3133
# $pulpcore_manage_postgresql:: Manage the Pulpcore PostgreSQL database.
@@ -81,6 +83,7 @@
8183

8284
Boolean $reverse_proxy = false,
8385
Stdlib::Port $reverse_proxy_port = 8443,
86+
Enum['h2', 'https'] $reverse_proxy_backend_protocol = 'h2',
8487

8588
Boolean $enable_yum = true,
8689
Boolean $enable_file = true,
@@ -120,6 +123,7 @@
120123
$foreman_url = $foreman_proxy::foreman_base_url
121124
$foreman_host = foreman_proxy_content::host_from_url($foreman_url)
122125
$reverse_proxy_real = $pulpcore_mirror or $reverse_proxy
126+
$proxy_foreman_url = $foreman_url.regsubst('https://', "${reverse_proxy_backend_protocol}://")
123127

124128
# TODO: make it configurable
125129
# https://github.com/theforeman/puppet-foreman_proxy_content/issues/407
@@ -137,7 +141,7 @@
137141

138142
if $reverse_proxy_real {
139143
foreman_proxy_content::reverse_proxy { "rhsm-pulpcore-https-${reverse_proxy_port}":
140-
path_url_map => { '/' => "${foreman_url}/" },
144+
path_url_map => { '/' => "${proxy_foreman_url}/" },
141145
port => $reverse_proxy_port,
142146
priority => '10',
143147
before => Class['pulpcore::apache'],
@@ -150,8 +154,8 @@
150154
if $rhsm_port != $reverse_proxy_port {
151155
foreman_proxy_content::reverse_proxy { $pulpcore_https_vhost_name:
152156
path_url_map => {
153-
$rhsm_path => "${foreman_url}${rhsm_path}",
154-
$insights_path => "${foreman_url}${insights_path}",
157+
$rhsm_path => "${proxy_foreman_url}${rhsm_path}",
158+
$insights_path => "${proxy_foreman_url}${insights_path}",
155159
},
156160
port => $rhsm_port,
157161
priority => '10',

manifests/reverse_proxy.pp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# @param priority
1616
# Sets the relative load-order for Apache HTTPD VirtualHost configuration files. See Apache::Vhost
1717
define foreman_proxy_content::reverse_proxy (
18-
Hash[Stdlib::Unixpath, Stdlib::Httpurl] $path_url_map = { '/' => "${foreman_proxy_content::foreman_url}/" },
18+
Hash[Stdlib::Unixpath, String[1]] $path_url_map = { '/' => "${foreman_proxy_content::foreman_url}/" },
1919
Stdlib::Port $port = $foreman_proxy_content::reverse_proxy_port,
2020
Variant[Array[String], String, Undef] $ssl_protocol = undef,
2121
Hash[String, Any] $vhost_params = {},
@@ -31,7 +31,7 @@
3131

3232
$vhost_name = $title
3333

34-
$proxy_pass = $path_url_map.map |Stdlib::Unixpath $path, Stdlib::Httpurl $url| {
34+
$proxy_pass = $path_url_map.map |$path, $url| {
3535
{
3636
'path' => $path,
3737
'url' => $url,

metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"name": "puppetlabs/apache",
25-
"version_requirement": ">= 2.0.0 < 12.0.0"
25+
"version_requirement": ">= 10.1.1 < 12.0.0"
2626
},
2727
{
2828
"name": "theforeman/foreman_proxy",

spec/classes/foreman_proxy_content_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,14 @@
201201
end
202202
it do
203203
is_expected.to contain_foreman_proxy_content__reverse_proxy('rhsm-pulpcore-https-8443')
204-
.with(path_url_map: {'/' => 'https://foo.example.com/'})
204+
.with(path_url_map: {'/' => 'h2://foo.example.com/'})
205205
.with(port: 8443)
206206
.with(priority: '10')
207207
.that_comes_before('Class[pulpcore::apache]')
208208
end
209209
it do
210210
is_expected.to contain_foreman_proxy_content__reverse_proxy('rhsm-pulpcore-https-443')
211-
.with(path_url_map: {'/rhsm' => 'https://foo.example.com/rhsm', '/redhat_access' => 'https://foo.example.com/redhat_access'})
211+
.with(path_url_map: {'/rhsm' => 'h2://foo.example.com/rhsm', '/redhat_access' => 'h2://foo.example.com/redhat_access'})
212212
.with(port: 443)
213213
.with(priority: '10')
214214
.that_comes_before('Class[pulpcore::apache]')

0 commit comments

Comments
 (0)