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

enable conditional and disable max_age by default #1886

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

davidism
Copy link
Member

@davidism davidism commented Jul 13, 2020

Tells browsers to validate cache conditions (etag, last modified, range) rather than using a 12 hour timed cache by default. This fixes the issue where developers who are actively editing or deploying new versions of static files from don't see changes.

  • Send Cache-Control: no-cache by default, or public if max_age > 0. no-cache doesn't actually mean "don't cache" (that would be no-store).
  • Rename cache_timeout to max_age. I think this makes it clearer that the parameter directly affects the Cache-Control: max-age value.
  • Reorder the cache-related parameters into an order that made a bit more sense to me.
  • Make the environ parameter required. It got added as optional when copying from Flask, but Flask's version would never be called without an active request. With conditional=True it's required by default anyway.

fixes #1882

  • Add tests that demonstrate the correct behavior of the change. Tests should fail without the change.
  • Add or update relevant docs, in the docs folder and in code.
  • Add an entry in CHANGES.rst summarizing the change and linking to the issue.
  • Add .. versionchanged:: entries in any relevant code docs.
  • Run pre-commit hooks and fix any issues.
  • Run pytest and tox, no tests failed.

@davidism davidism added this to the 2.0.0 milestone Jul 13, 2020
Let browsers validate conditions rather than using a 12 hour timed
cache by default.
Send Cache-Control: no-cache by default, or public if max_age > 0.
Rename cache_timeout to max_age.
Make environ parameter required.
@davidism davidism merged commit f32a8df into master Jul 13, 2020
@davidism davidism deleted the send_file-conditional branch July 13, 2020 04:39
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

send_file should set conditional=True and no-cache by default
1 participant