1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/actionpack/lib/action_dispatch/http
Tadas Sasnauskas 07da73429a Implement 'no_store' HTTP cache directive method
Summary
=======

Currently there is no way to set "Cache-Control: no-store" header using
built-in cache control methods ("expires_now"/"expires_in"/etc..). One of
the [top StackOverflow][1] answers currently suggests putting it directly
into header set.

Unfortunately, it cannot later be overridden in specific/individual actions by
calling say 'expires_in 5.minutes'. Resulting header in that case is
stays the same, i.e. 'Cache-Control: no-store'.

This:
 1. Adds the 'no_store' method to set "Cache-Control: no-store" header.
 2. Changes cache control "merge and normalize" code so default "no-store"
    directive can be overridden using built in cache control methods mentioned
    above.

What's the use of it
--------------------

Couple examples:

* To [prevent rendering stale content][3] if browser return button is used
('expires_now' does not help).
* To prevent browser disk cache being used. In some situations it's considered
a [privacy/security risk][4].

Other Information
=================

Mozilla developer docs for [Cache-Control][2] header.

[1]: https://stackoverflow.com/questions/10744169/rails-set-no-cache-method-cannot-disable-browser-caching-in-safari-and-opera
[2]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
[3]: https://engineering.mixmax.com/blog/chrome-back-button-cache-no-store/
[4]: https://portswigger.net/kb/issues/00700100_cacheable-https-response
2021-06-12 08:58:14 +01:00
..
cache.rb Implement 'no_store' HTTP cache directive method 2021-06-12 08:58:14 +01:00
content_disposition.rb Escape # in RFC 5987 pattern 2020-08-31 10:31:30 -04:00
content_security_policy.rb Add support for require-trusted-types-for and trusted-types csp headers 2021-05-04 16:54:23 -03:00
filter_parameters.rb Regexp example for filter parameters. 2021-01-29 05:26:20 +11:00
filter_redirect.rb Use match? where we don't need MatchData 2019-07-29 14:23:10 +09:00
headers.rb Reduce String allocations while handling HTTP headers 2019-08-19 00:03:25 +09:00
mime_negotiation.rb Use Enumerator#all? and Enumerator#any? with classes instead of iterations 2021-02-07 01:29:50 -05:00
mime_type.rb Remove redundant escapes 2021-05-08 20:13:31 +02:00
mime_types.rb Fix typo in mime type registering 2017-11-29 02:37:39 -05:00
parameters.rb Catch invalid UTF-8 encodings on ActionDispatch::Http::Request#POST (#40124) 2020-09-21 15:20:20 -04:00
permissions_policy.rb Use Feature-Policy header name for now 2020-11-19 16:08:09 +01:00
rack_cache.rb Use frozen string literal in actionpack/ 2017-07-29 14:02:40 +03:00
request.rb Drop support for the SERVER_ADDR header 2021-06-02 12:34:15 -05:00
response.rb Fix typo in deprecation warning 2021-02-04 22:56:20 +01:00
upload.rb Restore UploadedFile compatibility with IO.copy_stream 2019-02-23 23:36:58 +01:00
url.rb Drop support for the SERVER_ADDR header 2021-06-02 12:34:15 -05:00