Bug 10411 - Add cache control headers to static resources in the apache config
Summary: Add cache control headers to static resources in the apache config
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Packaging (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Robin Sheat
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-05 05:49 UTC by Robin Sheat
Modified: 2014-12-07 20:03 UTC (History)
6 users (show)

See Also:
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 (1.61 KB, patch)
2013-06-05 06:00 UTC, Robin Sheat
Details | Diff | Splinter Review
Bug 10411: add cache control headers for static resources (Debian package) (1.70 KB, patch)
2013-06-17 21:12 UTC, Galen Charlton
Details | Diff | Splinter Review
Bug 10411: add cache control headers for static resources (Debian package) (1.74 KB, patch)
2013-07-18 08:30 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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