Skip to content

Commit 63ee609

Browse files
authored
Merge pull request voxpupuli#924 from wyardley/feature_expires_snowmean
Add expires directive to location
2 parents acb6fb5 + adb73fa commit 63ee609

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

manifests/resource/location.pp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@
9797
# used for mp4 streaming. Default: false
9898
# [*flv*] - Indicates whether or not this loation can be
9999
# used for flv streaming. Default: false
100+
# [*expires*] - Setup expires time for locations content
100101
#
101102
#
102103
# Actions:
@@ -192,8 +193,9 @@
192193
$auth_basic_user_file = undef,
193194
$rewrite_rules = [],
194195
$priority = 500,
195-
$mp4 = false,
196-
$flv = false,
196+
$mp4 = false,
197+
$flv = false,
198+
$expires = undef,
197199
) {
198200

199201
$root_group = $::nginx::config::root_group
@@ -341,6 +343,9 @@
341343
if (($priority + 0) < 401) or (($priority + 0) > 899) {
342344
fail('$priority must be in the range 401-899.')
343345
}
346+
if ($expires != undef) {
347+
validate_string($expires)
348+
}
344349

345350
# # Shared Variables
346351
$ensure_real = $ensure ? {

spec/defines/resource_location_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@
7777
value: 'any',
7878
match: ' satisfy any;'
7979
},
80+
{
81+
title: 'should set expires',
82+
attr: 'expires',
83+
value: '33d',
84+
match: ' expires 33d;'
85+
},
8086
{
8187
title: 'should set location_allow',
8288
attr: 'location_allow',

templates/vhost/location_header.erb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<% if @location_satisfy -%>
1313
satisfy <%= @location_satisfy -%>;
1414
<% end -%>
15+
<% if @expires -%>
16+
expires <%= @expires %>;
17+
<% end -%>
1518
<% if @location_allow -%>
1619
<%- @location_allow.each do |allow_rule| -%>
1720
allow <%= allow_rule %>;

0 commit comments

Comments
 (0)