File tree Expand file tree Collapse file tree 5 files changed +109
-0
lines changed Expand file tree Collapse file tree 5 files changed +109
-0
lines changed Original file line number Diff line number Diff line change 1+ # @summary
2+ # Installs `mod_proxy_http2`.
3+ #
4+ # @see https://httpd.apache.org/docs/current/mod/mod_proxy_http2.html for additional documentation.
5+ #
6+ class apache::mod::proxy_http2 {
7+ require apache::mod::proxy
8+ apache::mod { 'proxy_http2' : }
9+ }
Original file line number Diff line number Diff line change 23032303
23042304 if $directory [' provider' ] and $directory [' provider' ] =~ ' location' and (' proxy_pass' in $directory or ' proxy_pass_match' in $directory ) {
23052305 include apache::mod::proxy_http
2306+
2307+ # To match processing in templates/vhost/_directories.erb
2308+ if $directory [' proxy_pass_match' ] {
2309+ Array($directory [' proxy_pass_match' ]).each |$proxy | {
2310+ if $proxy [' url' ] =~ /" h2c?:\/\/ / {
2311+ include apache::mod::proxy_http2
2312+ }
2313+ }
2314+ } elsif $directory ['proxy_pass'] {
2315+ Array($directory ['proxy_pass']).each |$proxy | {
2316+ if $proxy ['url'] =~ /" h2c?:\/\// {
2317+ include apache::mod::proxy_http2
2318+ }
2319+ }
2320+ }
23062321 }
23072322
23082323 if ' request_headers' in $directory {
24532468 if ($proxy_dest or $proxy_pass or $proxy_pass_match or $proxy_dest_match or $proxy_preserve_host or ($proxy_add_headers =~ NotUndef)) and $ensure == ' present' {
24542469 include apache::mod::proxy_http
24552470
2471+ # To match processing in templates/vhost/_proxy.erb
2472+ if $proxy_dest =~ Pattern[/^h2c?:\/\//] or $proxy_dest_match =~ Pattern[/^h2c?:\/\//] {
2473+ include apache::mod::proxy_http2
2474+ }
2475+ [$proxy_pass , $proxy_pass_match ].flatten.each |$proxy | {
2476+ if $proxy and $proxy [' url' ] =~ Pattern[/^h2c?:\/\//] {
2477+ include apache::mod::proxy_http2
2478+ }
2479+ }
2480+
24562481 concat::fragment { "${name}-proxy" :
24572482 target => " ${priority_real}${filename} .conf" ,
24582483 order => 170,
Original file line number Diff line number Diff line change 124124 include apache::mod::proxy
125125 include apache::mod::proxy_http
126126
127+ # To match processing in templates/vhost/_proxy.erb
128+ if $proxy_dest =~ Pattern[/^h2c?:\/\//] or $proxy_dest_match =~ Pattern[/^h2c?:\/\//] {
129+ include apache::mod::proxy_http2
130+ }
131+ [$proxy_pass , $proxy_pass_match ].flatten.each |$proxy | {
132+ if $proxy and $proxy [' url' ] =~ Pattern[/^h2c?:\/\//] {
133+ include apache::mod::proxy_http2
134+ }
135+ }
136+
127137 unless $proxy_dest or $proxy_pass or $proxy_pass_match or $proxy_dest_match {
128138 fail(' At least one of proxy_dest, proxy_pass, proxy_pass_match or proxy_dest_match must be given' )
129139 }
Original file line number Diff line number Diff line change 1+ # frozen_string_literal: true
2+
3+ require 'spec_helper'
4+
5+ describe 'apache::mod::proxy_http2' do
6+ on_supported_os . each do |os , os_facts |
7+ context "on #{ os } " do
8+ let ( :facts ) { os_facts }
9+
10+ it { is_expected . to compile . with_all_deps }
11+ it { is_expected . to contain_class ( 'apache::mod::proxy' ) }
12+ it { is_expected . to contain_apache__mod ( 'proxy_http2' ) }
13+ end
14+ end
15+ end
Original file line number Diff line number Diff line change 5353 CONTENT
5454 )
5555 end
56+
57+ context 'with HTTP/2 proxy_dest URL' do
58+ let ( :params ) do
59+ super ( ) . merge ( proxy_dest : 'h2://localhost:8080/' )
60+ end
61+
62+ it { is_expected . to compile . with_all_deps }
63+ it { is_expected . to contain_class ( 'apache::mod::proxy_http2' ) }
64+ end
65+
66+ context 'with HTTP/2 proxy_dest_match URL' do
67+ let ( :params ) do
68+ super ( ) . merge ( proxy_dest_match : 'h2://localhost:8080/' )
69+ end
70+
71+ it { is_expected . to compile . with_all_deps }
72+ it { is_expected . to contain_class ( 'apache::mod::proxy_http2' ) }
73+ end
74+
75+ context 'with HTTP/2 proxy_pass URL' do
76+ let ( :params ) do
77+ super ( ) . merge (
78+ proxy_pass : [
79+ {
80+ path : '/' ,
81+ url : 'h2://localhost:8080/'
82+ } ,
83+ ] ,
84+ )
85+ end
86+
87+ it { is_expected . to compile . with_all_deps }
88+ it { is_expected . to contain_class ( 'apache::mod::proxy_http2' ) }
89+ end
90+
91+ context 'with HTTP/2 proxy_pass_match URL' do
92+ let ( :params ) do
93+ super ( ) . merge (
94+ proxy_pass_match : [
95+ {
96+ path : '/' ,
97+ url : 'h2://localhost:8080/'
98+ } ,
99+ ] ,
100+ )
101+ end
102+
103+ it { is_expected . to compile . with_all_deps }
104+ it { is_expected . to contain_class ( 'apache::mod::proxy_http2' ) }
105+ end
56106 end
57107 end
58108 end
You can’t perform that action at this time.
0 commit comments