Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

When specifying public Cache-Control, also specify max-age

#3839

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

Reported by Bill Kirtley · February 2nd, 2010 @ 10:00 PM

State: stale
Milestone: none
Assigned to: nobody
Importance: Low

Activity

  1. Bill Kirtley
    Bill Kirtley
    • 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.

    February 3rd, 2010 @ 04:17 PM

  2. Bill Kirtley
    Bill Kirtley
    • Tag changed from actionpack, action_pack, caching, patch to 2.3.x, actionpack, action_pack, caching, patch

    February 3rd, 2010 @ 04:53 PM

  3. Rohit Arondekar
    Rohit Arondekar
    • 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.

    October 9th, 2010 @ 03:20 AM

  4. Ryan Bigg
    Ryan Bigg
    • Tag cleared.

    Automatic cleanup of spam.

    October 9th, 2010 @ 09:52 PM