When the Cache-Control header is set to no-store, the response is cached.
settings.py
...
MIDDLEWARE = [
"django.middleware.cache.UpdateCacheMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.cache.FetchFromCacheMiddleware",
]
...
views.py
from django.http import HttpResponse
import datetime
def cache_demo(request):
resp = HttpResponse(f"Current content at {datetime.datetime.now()}")
resp["Cache-Control"] = "no-store"
return resp
Based on the example above, when the Cache-Control header is set to no-store, the response content is still cached.
Change History
(11)
| Description: |
modified (diff)
|
| Component: |
Core (Cache system) → HTTP handling
|
| Needs tests: |
set
|
| Triage Stage: |
Unreviewed → Accepted
|
| Type: |
Bug → Cleanup/optimization
|
| Owner: |
set to Jagadesha NH
|
| Status: |
new → assigned
|
| Owner: |
Jagadesha NH removed
|
| Status: |
assigned → new
|
| Owner: |
set to mengxun
|
| Status: |
new → assigned
|
| Needs tests: |
unset
|
| Triage Stage: |
Accepted → Ready for checkin
|
| Resolution: |
→ fixed
|
| Status: |
assigned → closed
|
Similar to #28833, can work around by using @never_cache