Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/thurloat/django-postleware
A simple django middleware that ensures POSTs aren't cached by clients.
https://github.com/thurloat/django-postleware
Last synced: 9 days ago
JSON representation
A simple django middleware that ensures POSTs aren't cached by clients.
- Host: GitHub
- URL: https://github.com/thurloat/django-postleware
- Owner: thurloat
- License: other
- Created: 2013-01-17T02:13:23.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2013-01-28T13:28:44.000Z (almost 12 years ago)
- Last Synced: 2024-10-07T11:46:55.548Z (about 1 month ago)
- Language: Python
- Size: 129 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
django-postleware
#################A simple django middleware class which injects a `Cache-Control: no-cache`
header onto POST responses.Installing
##########1. `pip install django-postleware`
2. Add the middleware to `settings.py`.. code-block:: python
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.