Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

apache::mod::expires hiera format

Hi,

I'm trying to identify the correct format for listing MIME types and expiration times in hiera. The module uses the following .erb template, but it doesn't seem to work when passing the hiera below. I'm still getting used to moving code from puppet manifests to hiera, so I'm not 100% sure the formatting is right.

 ExpiresActive <%= scope.function_bool2httpd([@expires_active]) %>
    <%- if ! @expires_default.nil? and ! @expires_default.empty? -%>
    ExpiresDefault "<%= @expires_default %>"
    <%- end -%>
    <%- if ! @expires_by_type.nil? and ! @expires_by_type.empty? -%>
    <%- [@expires_by_type].flatten.each do |line| -%>
    <%- line.map do |type, seconds| -%>
    ExpiresByType <%= type %> "<%= seconds -%>"
    <%- end -%>
    <%- end -%>
    <%- end -%>

Using:

apache::mod::expires:
  expires_active: true
  expires_default: 'access plus 5 seconds'
  expires_by_type:
    'image/x-icon': 'access plus 2592000 seconds'
    'image/jpeg': 'access plus 2592000 seconds'
    'image/png': 'access plus 2592000 seconds'
    'image/gif': 'access plus 2592000 seconds'
    'text/css': 'access plus 604800 seconds'

I've also tried:

apache::mod::expires::expires_active: true
apache::mod::expires::expires_default: 'access plus 5 seconds'
apache::mod::expires::expires_by_type: [
    'image/x-icon': 'access plus 2592000 seconds',
    'image/jpeg': 'access plus 2592000 seconds', ]

apache::mod::expires hiera format

Hi,

I'm trying to identify the correct format for listing MIME types and expiration times in hiera. The module uses the following .erb template, but it doesn't seem to work when passing the hiera below. I'm still getting used to moving code from puppet manifests to hiera, so I'm not 100% sure the formatting is right.

 ExpiresActive <%= scope.function_bool2httpd([@expires_active]) %>
    <%- if ! @expires_default.nil? and ! @expires_default.empty? -%>
    ExpiresDefault "<%= @expires_default %>"
    <%- end -%>
    <%- if ! @expires_by_type.nil? and ! @expires_by_type.empty? -%>
    <%- [@expires_by_type].flatten.each do |line| -%>
    <%- line.map do |type, seconds| -%>
    ExpiresByType <%= type %> "<%= seconds -%>"
    <%- end -%>
    <%- end -%>
    <%- end -%>

Using:

apache::mod::expires:
  expires_active: true
  expires_default: 'access plus 5 seconds'
  expires_by_type:
    'image/x-icon': 'access plus 2592000 seconds'
    'image/jpeg': 'access plus 2592000 seconds'
    'image/png': 'access plus 2592000 seconds'
    'image/gif': 'access plus 2592000 seconds'
    'text/css': 'access plus 604800 seconds'

I've also tried:

apache::mod::expires::expires_active: true
apache::mod::expires::expires_default: 'access plus 5 seconds'
apache::mod::expires::expires_by_type: [
    'image/x-icon': 'access plus 2592000 seconds',
    'image/jpeg': 'access plus 2592000 seconds', ]

Even with just below, no expires.conf appears in /etc/httpd/conf.modules.d/ and no errors either.

apache::mod::expires::expires_active: true
apache::mod::expires::expires_default: 'access plus 5 seconds'