Skip to content

Commit b39756f

Browse files
committed
feature #8442 Update http_cache.rst (tabbi89, javiereguiluz)
This PR was merged into the 2.7 branch. Discussion ---------- Update http_cache.rst I want to point out that POST method is cacheable however this is very very narrow case but it is possible. Reading documentation you can learn that POST is not cacheable but this is not true and technically you can cache it. Commits ------- e89aab0 Reworded the explanation abut POST caching 44e569f Update http_cache.rst
2 parents da08896 + e89aab0 commit b39756f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

http_cache.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ Nottingham's `Cache Tutorial`_.
3333
.. index::
3434
single: Cache; Proxy
3535
single: Cache; Reverse proxy
36-
single: Cache; Gateway
3736

3837
.. _gateway-caches:
3938

@@ -286,11 +285,15 @@ Safe Methods: Only caching GET or HEAD requests
286285
HTTP caching only works for "safe" HTTP methods (like GET and HEAD). This means
287286
two things:
288287

289-
* Don't try to cache PUT, POST or DELETE requests. It won't work and with good
290-
reason. These methods are meant to be used when mutating the state of your application
288+
* Don't try to cache PUT or DELETE requests. It won't work and with good reason.
289+
These methods are meant to be used when mutating the state of your application
291290
(e.g. deleting a blog post). Caching them would prevent certain requests from hitting
292291
and mutating your application.
293292

293+
* POST requests are generally considered uncachable, but `they can be cached`_
294+
when they include explicit freshness information. However POST caching is not
295+
widely implemented, so you should avoid it if possible.
296+
294297
* You should *never* change the state of your application (e.g. update a blog post)
295298
when responding to a GET or HEAD request. If those requests are cached, future
296299
requests may not actually hit your server.
@@ -366,3 +369,4 @@ Learn more
366369
.. _`RFC 7234 - Caching`: https://tools.ietf.org/html/rfc7234
367370
.. _`RFC 7232 - Conditional Requests`: https://tools.ietf.org/html/rfc7232
368371
.. _`FOSHttpCacheBundle`: http://foshttpcachebundle.readthedocs.org/
372+
.. _`they can be cached`: https://tools.ietf.org/html/draft-ietf-httpbis-p2-semantics-20#section-2.3.4

0 commit comments

Comments
 (0)