Skip to content

Commit

Permalink
expires_in extras documentation (#38625)
Browse files Browse the repository at this point in the history
* `expires_in` `extras` documentation

Wanted to find how to add `s-maxage` and stumbled across this feature.

Wanted to document it for others, but many proxies like Akamai are very insistent on using `s-maxage` rather than `max-age`.

* Altered verbiage and fixed spelling
  • Loading branch information
Quinn Chaffee committed Mar 14, 2020
1 parent 54cb016 commit 8cdef19
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions actionpack/lib/action_controller/metal/conditional_get.rb
Expand Up @@ -237,6 +237,11 @@ def stale?(object = nil, **freshness_kwargs)
# expires_in 3.hours, public: true, stale_while_revalidate: 60.seconds
# expires_in 3.hours, public: true, stale_while_revalidate: 60.seconds, stale_if_error: 5.minutes
#
# HTTP Cache-Control Extensions other values: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
# Any additional key-value pairs are concatenated onto the `Cache-Control` header in the response:
#
# expires_in 3.hours, public: true, "s-maxage": 3.hours, "no-transform": true
#
# The method will also ensure an HTTP Date header for client compatibility.
def expires_in(seconds, options = {})
response.cache_control.merge!(
Expand Down

0 comments on commit 8cdef19

Please sign in to comment.