This project is archived and is in readonly mode.
When specifying public Cache-Control, also specify max-age
Reported by Bill Kirtley | February 2nd, 2010 @ 10:00 PM
The ActionController stale? and fresh_when functions will take a :public option, which will cause emission of a Cache-Control header with a public attribute.
Proxy caches will likely interpret a "Cache-Control: public" header to mean that the resource will never change, and will cache it forever.
If you're using either stale? or fresh_when, it's probably because the controlled resource does change over time, so you want to specify a max-age directive in the Cache-Control header to tell the proxy cache how long to serve the resource before asking the origin if it's changed.
Use of expires_in does set the max-age, and it is a workaround for this problem, but it feels awkward to have to do both.
Adding a :max_age option to fresh_when would deal with this nicely
Comments and changes to this ticket
-
Bill Kirtley February 3rd, 2010 @ 04:17 PM
- Tag changed from actionpack, action_pack, caching to actionpack, action_pack, caching, patch
cache_control_max_age-2-3-stable.patch is an implementation for the 2-3-stable branch.
-
Bill Kirtley February 3rd, 2010 @ 04:53 PM
- Tag changed from actionpack, action_pack, caching, patch to 2.3.x, actionpack, action_pack, caching, patch
-
Rohit Arondekar October 9th, 2010 @ 03:20 AM
- State changed from new to stale
- Importance changed from to Low
Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>