Skip to content

Commit

Permalink
Use mod_proxy_http2
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
ekohl committed Oct 13, 2023
1 parent e359501 commit 1fff73f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
7 changes: 4 additions & 3 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
$foreman_url = $foreman_proxy::foreman_base_url
$foreman_host = foreman_proxy_content::host_from_url($foreman_url)
$reverse_proxy_real = $pulpcore_mirror or $reverse_proxy
$proxy_foreman_url = $foreman_url.regsubst('https://', 'h2://')

# TODO: make it configurable
# https://github.com/theforeman/puppet-foreman_proxy_content/issues/407
Expand All @@ -137,7 +138,7 @@

if $reverse_proxy_real {
foreman_proxy_content::reverse_proxy { "rhsm-pulpcore-https-${reverse_proxy_port}":
path_url_map => { '/' => "${foreman_url}/" },
path_url_map => { '/' => "${proxy_foreman_url}/" },
port => $reverse_proxy_port,
priority => '10',
before => Class['pulpcore::apache'],
Expand All @@ -150,8 +151,8 @@
if $rhsm_port != $reverse_proxy_port {
foreman_proxy_content::reverse_proxy { $pulpcore_https_vhost_name:
path_url_map => {
$rhsm_path => "${foreman_url}${rhsm_path}",
$insights_path => "${foreman_url}${insights_path}",
$rhsm_path => "${proxy_foreman_url}${rhsm_path}",
$insights_path => "${proxy_foreman_url}${insights_path}",
},
port => $rhsm_port,
priority => '10',
Expand Down
4 changes: 2 additions & 2 deletions manifests/reverse_proxy.pp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# @param priority
# Sets the relative load-order for Apache HTTPD VirtualHost configuration files. See Apache::Vhost
define foreman_proxy_content::reverse_proxy (
Hash[Stdlib::Unixpath, Stdlib::Httpurl] $path_url_map = { '/' => "${foreman_proxy_content::foreman_url}/" },
Hash[Stdlib::Unixpath, String[1]] $path_url_map = { '/' => "${foreman_proxy_content::foreman_url}/" },
Stdlib::Port $port = $foreman_proxy_content::reverse_proxy_port,
Variant[Array[String], String, Undef] $ssl_protocol = undef,
Hash[String, Any] $vhost_params = {},
Expand All @@ -31,7 +31,7 @@

$vhost_name = $title

$proxy_pass = $path_url_map.map |Stdlib::Unixpath $path, Stdlib::Httpurl $url| {
$proxy_pass = $path_url_map.map |$path, $url| {
{
'path' => $path,
'url' => $url,
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
{
"name": "puppetlabs/apache",
"version_requirement": ">= 2.0.0 < 12.0.0"
"version_requirement": ">= 10.1.1 < 12.0.0"
},
{
"name": "theforeman/foreman_proxy",
Expand Down
4 changes: 2 additions & 2 deletions spec/classes/foreman_proxy_content_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,14 @@
end
it do
is_expected.to contain_foreman_proxy_content__reverse_proxy('rhsm-pulpcore-https-8443')
.with(path_url_map: {'/' => 'https://foo.example.com/'})
.with(path_url_map: {'/' => 'h2://foo.example.com/'})
.with(port: 8443)
.with(priority: '10')
.that_comes_before('Class[pulpcore::apache]')
end
it do
is_expected.to contain_foreman_proxy_content__reverse_proxy('rhsm-pulpcore-https-443')
.with(path_url_map: {'/rhsm' => 'https://foo.example.com/rhsm', '/redhat_access' => 'https://foo.example.com/redhat_access'})
.with(path_url_map: {'/rhsm' => 'h2://foo.example.com/rhsm', '/redhat_access' => 'h2://foo.example.com/redhat_access'})
.with(port: 443)
.with(priority: '10')
.that_comes_before('Class[pulpcore::apache]')
Expand Down

0 comments on commit 1fff73f

Please sign in to comment.