Skip to content

Commit 6cce07d

Browse files
committed
Add FileETag to vhost and directory
1 parent 74d3c54 commit 6cce07d

File tree

4 files changed

+42
-0
lines changed

4 files changed

+42
-0
lines changed

manifests/vhost.pp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@
106106
# default setting omits the declaration from the server configuration and selects the
107107
# Apache default setting of `Off`.
108108
#
109+
# @param file_e_tag
110+
# Sets the server default for the `FileETag` declaration, which modifies the response header
111+
# field for static files.
112+
#
109113
# @param block
110114
# Specifies the list of things to which Apache blocks access. Valid options are: `scm` (which
111115
# blocks web access to `.svn`), `.git`, and `.bzr` directories.
@@ -1861,6 +1865,7 @@
18611865
Variant[Array[String], String] $additional_includes = [],
18621866
Boolean $use_optional_includes = $apache::use_optional_includes,
18631867
Optional[Variant[Apache::OnOff, Enum['nodecode']]] $allow_encoded_slashes = undef,
1868+
Optional[String] $file_e_tag = undef,
18641869
Optional[Pattern[/^[\w-]+ [\w-]+$/]] $suexec_user_group = undef,
18651870

18661871
Optional[Boolean] $h2_copy_files = undef,
@@ -2977,6 +2982,17 @@
29772982
}
29782983
}
29792984

2985+
if $file_e_tag {
2986+
$file_e_tag_params = {
2987+
'file_e_tag' => $file_e_tag,
2988+
}
2989+
concat::fragment { "${name}-file_e_tag":
2990+
target => "${priority_real}${filename}.conf",
2991+
order => 410,
2992+
content => epp('apache/vhost/_file_e_tag.epp', $file_e_tag_params),
2993+
}
2994+
}
2995+
29802996
$file_footer_params = {
29812997
'define' => $define,
29822998
'passenger_pre_start' => $passenger_pre_start,

spec/acceptance/vhost_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,4 +1306,23 @@ class { 'apache': }
13061306
it { is_expected.to contain 'OIDCCryptoPassphrase 4ad1bb46-9979-450e-ae58-c696967df3cd' }
13071307
end
13081308
end
1309+
1310+
describe 'file_e_tag' do
1311+
pp = <<-MANIFEST
1312+
class { 'apache': }
1313+
apache::vhost { 'test.server':
1314+
port => 80,
1315+
docroot => '/var/www/html',
1316+
file_e_tag => 'None',
1317+
}
1318+
MANIFEST
1319+
it 'applies cleanly' do
1320+
apply_manifest(pp, catch_failures: true)
1321+
end
1322+
1323+
describe file("#{apache_hash['vhost_dir']}/25-test.server.conf") do
1324+
it { is_expected.to be_file }
1325+
it { is_expected.to contain 'FileETag None' }
1326+
end
1327+
end
13091328
end

templates/vhost/_directories.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@
7777
</FilesMatch>
7878
<%- end -%>
7979
<%- end -%>
80+
<%- unless directory['file_e_tag'].nil? -%>
81+
FileETag <%= directory['file_e_tag'] %>
82+
<%- end -%>
8083
<%- if directory['sethandler'] and directory['sethandler'] != '' -%>
8184
SetHandler <%= directory['sethandler'] %>
8285
<%- end -%>

templates/vhost/_file_e_tag.epp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<%- if $file_e_tag { -%>
2+
3+
FileETag <%= $file_e_tag %>
4+
<%- } -%>

0 commit comments

Comments
 (0)