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 ...@@ -9,6 +9,8 @@ default['foswiki']['apache']['https_port'] = 443
default['foswiki']['apache']['log_level'] = 'info' default['foswiki']['apache']['log_level'] = 'info'
default['foswiki']['apache']['protect_attachments'] = true default['foswiki']['apache']['protect_attachments'] = true
default['foswiki']['apache']['protect_safe_attachments'] = false 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_admin'] = "webmaster@#{node['fqdn']}"
default['foswiki']['apache']['server_alias'] = [] default['foswiki']['apache']['server_alias'] = []
default['foswiki']['apache']['server_name'] = node['fqdn'] default['foswiki']['apache']['server_name'] = node['fqdn']
......
...@@ -3,7 +3,7 @@ maintainer 'HPC' ...@@ -3,7 +3,7 @@ maintainer 'HPC'
maintainer_email 'hpc@gsi.de' maintainer_email 'hpc@gsi.de'
license 'All rights reserved' license 'All rights reserved'
description 'Installs/Configures Foswiki' description 'Installs/Configures Foswiki'
version '2.1.4' version '2.2.0'
depends 'apache2', '< 6.0' depends 'apache2', '< 6.0'
supports 'debian' supports 'debian'
supports 'ubuntu' supports 'ubuntu'
...@@ -5,6 +5,7 @@ include_recipe 'apache2' ...@@ -5,6 +5,7 @@ include_recipe 'apache2'
apache_conf = node['foswiki']['apache'] apache_conf = node['foswiki']['apache']
include_recipe 'apache2::mod_ssl' if apache_conf['use_tls'] 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'] if apache_conf['use_fcgi']
include_recipe 'apache2::mod_fcgid' include_recipe 'apache2::mod_fcgid'
...@@ -37,6 +38,8 @@ web_app apache_conf['server_name'] do ...@@ -37,6 +38,8 @@ web_app apache_conf['server_name'] do
protect_attachments apache_conf['protect_attachments'] protect_attachments apache_conf['protect_attachments']
protect_safe_attachments apache_conf['protect_safe_attachments'] protect_safe_attachments apache_conf['protect_safe_attachments']
pub_dir dirs['pub'] 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 pub_url_path pub_url_path
script_dir dirs['script'] script_dir dirs['script']
script_url_path script_url_path script_url_path script_url_path
......
...@@ -189,18 +189,17 @@ ...@@ -189,18 +189,17 @@
# This line will redefine the mime type for the most common types of scripts # 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 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 # 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 # 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. <ifmodule mod_expires.c>
# you may need to enable expires_module in your main apache config <filesmatch "<%= @params[:pub_expires_match] %>">
ExpiresActive on
# <ifmodule mod_expires.c> ExpiresDefault "<%= @params[:pub_expires_time] %>"
# <filesmatch "<%= @params[:pub_expires_match] %>"> </filesmatch>
# ExpiresActive on </ifmodule>
# ExpiresDefault "<%= @params[:pub_expires_time] %>"
# </filesmatch> <% end -%>
# </ifmodule>
#
# Serve pre-compressed versions of .js and .css files, if they exist # 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 # Some browsers do not handle this correctly, which is why it is disabled by default
# <FilesMatch "\.(js|css)$"> # <FilesMatch "\.(js|css)$">
......
Markdown is supported
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