{{{
no-cache
If the no-cache directive does not specify a field-name, then a cache MUST
NOT use the response to satisfy a subsequent request without successful
revalidation with the origin server. This allows an origin server to
prevent caching even by caches that have been configured to return stale
responses to client requests.
If the no-cache directive does specify one or more field-names, then a
cache MAY use the response to satisfy a subsequent request, subject to any
other restrictions on caching. However, the specified field-name(s) MUST
NOT be sent in the response to a subsequent request without successful
revalidation with the origin server. This allows an origin server to
prevent the re-use of certain header fields in a response, while still
allowing caching of the rest of the response.
}}}
For example, to integrate a site that uses "Vary: Cookie" with AWS
CloudFront, one must use 'Cache-Control: no-cache="Set-Cookie"' if a
response does not vary by cookie. (I've confirmed this with AWS support
as of 10/31/2014).
patch_cache_control does not treat "no-cache" as a list. If you call
patch_cache_control(response, no_cache="Set-Cookie") and then
patch_cache_control(response, no_cache="foo"), you end up with 'Cache-
Control: no-cache="foo"'
Also, no_cache=True should take precedence over no_cache="foo" regardless
of the order it is applied.
I found Ticket https://code.djangoproject.com/ticket/13008 which proposes
to add "no-cache" to @never_cache. Just wanted to link it here since they
are related.
--
Ticket URL: <https://code.djangoproject.com/ticket/23755>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* cc: wgordonw1@… (added)
* needs_docs: => 0
* needs_tests: => 0
* needs_better_patch: => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:1>
* type: Uncategorized => New feature
* version: 1.7 => master
* component: Uncategorized => Core (Cache system)
* stage: Unreviewed => Accepted
Old description:
New description:
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:2>
* owner: nobody => Flavio Curella
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:3>
* has_patch: 0 => 1
Comment:
[https://github.com/django/django/pull/11829 PR]
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:4>
* needs_better_patch: 0 => 1
* needs_docs: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:5>
* needs_better_patch: 1 => 0
* needs_docs: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:6>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"9facc9002079d2713bb2591ca01f3aca0b678a00" 9facc900]:
{{{
#!CommitTicketReference repository=""
revision="9facc9002079d2713bb2591ca01f3aca0b678a00"
Refs #23755 -- Added tests for patch_cache_control() with no-cache Cache-
Control directive.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:7>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"ed112fadc1cfa400dbee6080bf82fd7536ea4c72" ed112fad]:
{{{
#!CommitTicketReference repository=""
revision="ed112fadc1cfa400dbee6080bf82fd7536ea4c72"
Fixed #23755 -- Added support for multiple field names in the no-cache
Cache-Control directive to patch_cache_control().
https://tools.ietf.org/html/rfc7234#section-5.2.2.2
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23755#comment:8>