Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify expires_now documentation #26016

Merged
merged 1 commit into from Sep 7, 2016
Merged

Conversation

nateberkopec
Copy link
Contributor

Changed my mind about #19556 to @matthewd's position. For those unfamiliar with HTTP caching, the docs (and the value set in the method) could be confusing.
#19556 brought up that the documentation for expires_now is somewhat confusing. In most caching contexts (like in Rails fragment caching), saying you're "not caching" something means that the value is not stored anywhere and must be recalculated every time. This is not how it works in HTTP, so a method that sets "no_cache" may be misread as "don't allow the client or intermediate caches to store this value." This change makes that explicit, so no one accidentally uses expire_now to try to prevent sensitive information from being cached.

@rails-bot
Copy link

r? @schneems

(@rails-bot has picked a reviewer for you, use r? to override)

# Sets an HTTP 1.1 Cache-Control header of <tt>no-cache</tt> so no caching should
# occur by the browser or intermediate caches (like caching proxy servers).
# Sets an HTTP 1.1 Cache-Control header of <tt>no-cache</tt>. This means the
# asset will always be marked as stale, so clients must always revalidate.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you drop the initial 'always'.
.. the asset with be marked as stale, so clients ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd replace asset with resource, and keep the initial 'always' for emphasis.

@nateberkopec
Copy link
Contributor Author

Updated, I ended up agreeing with both @vijaydev and @vipulnsward.

@vipulnsward vipulnsward merged commit e703fc1 into rails:master Sep 7, 2016
@vipulnsward
Copy link
Member

Thanks @nateberkopec !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants