Commit ffb9fcd6 authored by André Kerkhoff's avatar André Kerkhoff
Browse files

Add option to set /pub expire date for apache

parent d35e418a
......@@ -9,6 +9,8 @@ default['foswiki']['apache']['https_port'] = 443
default['foswiki']['apache']['log_level'] = 'info'
default['foswiki']['apache']['protect_attachments'] = true
default['foswiki']['apache']['protect_safe_attachments'] = false
default['foswiki']['apache']['pub_expires_time'] = nil # e.g. "access plus 11 days"
default['foswiki']['apache']['pub_expires_match'] = '\.(jpe?g|gif|png|css(\.gz)?|js(\.gz)?|ico)$'
default['foswiki']['apache']['server_admin'] = "webmaster@#{node['fqdn']}"
default['foswiki']['apache']['server_alias'] = []
default['foswiki']['apache']['server_name'] = node['fqdn']
......
......@@ -3,7 +3,7 @@ maintainer 'HPC'
maintainer_email 'hpc@gsi.de'
license 'All rights reserved'
description 'Installs/Configures Foswiki'
version '2.1.4'
version '2.2.0'
depends 'apache2', '< 6.0'
supports 'debian'
supports 'ubuntu'
......@@ -5,6 +5,7 @@ include_recipe 'apache2'
apache_conf = node['foswiki']['apache']
include_recipe 'apache2::mod_ssl' if apache_conf['use_tls']
include_recipe 'apache2::mod_expires' if apache_conf['pub_expires_time']
if apache_conf['use_fcgi']
include_recipe 'apache2::mod_fcgid'
......@@ -37,6 +38,8 @@ web_app apache_conf['server_name'] do
protect_attachments apache_conf['protect_attachments']
protect_safe_attachments apache_conf['protect_safe_attachments']
pub_dir dirs['pub']
pub_expires_match apache_conf['pub_expires_match']
pub_expires_time apache_conf['pub_expires_time']
pub_url_path pub_url_path
script_dir dirs['script']
script_url_path script_url_path
......
......@@ -189,18 +189,17 @@
# This line will redefine the mime type for the most common types of scripts
AddType text/plain .shtml .php .php3 .phtml .phtm .pl .py .cgi
<% if @params[:pub_expires_time] -%>
# add an Expires header that is sufficiently in the future that the browser does not even ask if its uptodate
# reducing the load on the server significantly
# IF you can, you should enable this - it _will_ improve your Foswiki experience, even if you set it to under one day.
# you may need to enable expires_module in your main apache config
# <ifmodule mod_expires.c>
# <filesmatch "<%= @params[:pub_expires_match] %>">
# ExpiresActive on
# ExpiresDefault "<%= @params[:pub_expires_time] %>"
# </filesmatch>
# </ifmodule>
#
<ifmodule mod_expires.c>
<filesmatch "<%= @params[:pub_expires_match] %>">
ExpiresActive on
ExpiresDefault "<%= @params[:pub_expires_time] %>"
</filesmatch>
</ifmodule>
<% end -%>
# Serve pre-compressed versions of .js and .css files, if they exist
# Some browsers do not handle this correctly, which is why it is disabled by default
# <FilesMatch "\.(js|css)$">
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment