EllisLab/CodeIgniter — pull request #962 by atiredmachine (2012-01-24 08:59:59+00:00)
Title: Added HTTP Cache/Expires/Modified Headers to match file caching settings...

Hey, this is my first time using Git so I hope I'm doing this right.

Anyways, I added a function to the output class that sets the HTTP cache headers to match the file caching settings. That way if a page is set to expire from cache after 24 hours, it will also stay in the browser cache for 24 hours as well.

I implemented both "Last-modified" and "Expires"/"Max-age" methods.

This is especially useful for cutting down on bandwidth caused by search engine spiders. If a search engine requests a page but the file is still cached, now CodeIgniter will respond with a 304 (Not modified) instead of re-serving the page.

My thought is that if a developer for some reason does not want this behavior that it could be over-ridden by a config setting. But I'm having trouble thinking up cases where file caching is desired but browser caching is not.

This is the first of a few cache-related features I requested here:
http://codeigniter.uservoice.com/forums/40508-codeigniter-reactor/suggestions/2530591-cache-output-library-improvements-overhaul-?tracking_code=57a1219af213e7d050ef5dd9064ca9b7