A simple django middleware that ensures POSTs aren't cached by clients.
Project description
django-postleware
A simple django middleware class which injects a Cache-Control: no-cache header onto POST responses.
Installing
pip install django-postleware
Add the middleware to settings.py
MIDDLEWARE_CLASSES = (
'postleware.PostResponseCachebusterMiddleware',
# ...
)
Why?
Mobile Webkit (iOS4+ and Android stock bowser) has a bug that causes it to cache similar POST requests when it clearly shouldn’t. Rather than only caching requests that have a specific Cache-Control header, it does the opposite and caches the request unless the no-cache value is present in the POST response.
Not working for you?
Let me know by opening an issue or pull request. This was enough for me, but I have read around the webs that other devs needed to add additional headers to the response before it would stop caching.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-postleware-1.0.1.tar.gz
.
File metadata
- Download URL: django-postleware-1.0.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 146ed96753930132e1087f5d94b50e82c3d6a85387cd609bd015655711cb1a8b |
|
MD5 | b8f1b61c8c93caf4bad6386268c0f848 |
|
BLAKE2b-256 | f42a7d698ef126e5d8cea973c45c4e2eb95752a990befa940d11bcbfb2774324 |