Bug 10411

Summary: Add cache control headers to static resources in the apache config
Product: Koha Reporter: Robin Sheat <robin>
Component: PackagingAssignee: Robin Sheat <robin>
Status: CLOSED FIXED QA Contact: Jonathan Druart <jonathan.druart>
Severity: enhancement    
Priority: P5 - low CC: bgkriegel, chrish, gmcharlt, jonathan.druart, robin, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 10411 - add cache control headers for static resources
Bug 10411: add cache control headers for static resources (Debian package)
Bug 10411: add cache control headers for static resources (Debian package)

Description Robin Sheat 2013-06-05 05:49:57 UTC
Currently, the static resources aren't explicitly cached. In the case of firefox, this causes a request every time for every image, that usually results in a 304 Not Modified response. This isn't a good use of apache's time, also may make the page appear to render a bit slower.

The patch for this will put a 12 hour cache timeout on the images, javascript, and CSS files.
Comment 1 Robin Sheat 2013-06-05 06:00:58 UTC Comment hidden (obsolete)
Comment 2 Galen Charlton 2013-06-17 21:12:16 UTC Comment hidden (obsolete)
Comment 3 Jonathan Druart 2013-07-18 08:30:10 UTC
QA comment:
Looks good to me, works as expected.
Marked as Passed QA.
Comment 4 Jonathan Druart 2013-07-18 08:30:22 UTC
Created attachment 19750 [details] [review]
Bug 10411: add cache control headers for static resources (Debian package)

This adds caching directives to the static resources so that the browser
doesn't ask about them all the time.

By default, Debian apache doesn't have the required module (mod_expires)
enabled, and so this patch will have no effect. In order to enable this
function, run:

a2enmod expires

and restart apache.

Test Plan:
* Using firebug or equivalent, load a page.
* Note that none of the images, css, or js files have a Cache-Control or
  Expires header set.
* Add this patch, redeploy the package with it (or overwrite the
  apache-share.conf file) enable the 'expires' module, restart apache.
* Force-reload the page
* Note that the images, css, js now have Cache-Control and Expires set
  for 12 hours into the future.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>
Comment 5 Galen Charlton 2013-07-18 13:51:35 UTC
Pushed to master.  Thanks, Robin!
Comment 6 Tomás Cohen Arazi 2013-07-22 15:03:29 UTC
This patch has been pushed to 3.12.x, will be in 3.12.2.

Thanks Robin!
Comment 7 Bernardo Gonzalez Kriegel 2013-08-04 19:59:17 UTC
Pushed to 3.10.x, will be in 3.10.10
Comment 8 Chris Hall 2013-08-20 09:04:22 UTC
Pushed to 3.8.x, will be in 3.8.17