diff --git a/spec/defines/resource_server_spec.rb b/spec/defines/resource_server_spec.rb index d4ec18535..625315cb1 100644 --- a/spec/defines/resource_server_spec.rb +++ b/spec/defines/resource_server_spec.rb @@ -844,6 +844,12 @@ attr: 'index_files', value: [], notmatch: %r{\s+index\s+} + }, + { + title: 'should set autoindex', + attr: 'autoindex', + value: 'on', + match: ' autoindex on;' } ].each do |param| context "when #{param[:attr]} is #{param[:value]}" do diff --git a/templates/server/server_ssl_header.erb b/templates/server/server_ssl_header.erb index 67560dd91..3832637e7 100644 --- a/templates/server/server_ssl_header.erb +++ b/templates/server/server_ssl_header.erb @@ -64,7 +64,9 @@ server { <% end -%> <% if @index_files and @index_files.count > 0 -%> index <% Array(@index_files).each do |i| %> <%= i %><% end %>; - +<% end -%> +<% if defined? @autoindex -%> + autoindex <%= @autoindex %>; <% end -%> <% if @absolute_redirect -%> absolute_redirect <%= @absolute_redirect %>;