because writing is clarifying

because writing is clarifying

Subbu Allamaraju’s Journal

POST Caching Example

Here is a good example of caching of POST responses by Henrik Nordström in the HTTP WG.

The classic example of where a cacheable response to POST makes sense is the guestbook example (or unmoderated blog comments for those needing a more modern example, basically the same thing in a different era) where the visitor POSTs an addition to the page currently viewed, or “separate entity that accepts annotations” as it’s expressed in the RFC. The response given to the POST is the new representation of the page. Both
GET and POST uses the same URL in this example.

followed by

Note that the POST request as such can never be satisfied from cache. A repeated POST with the same form content will not yield the same result even if the response is cacheable.

The context of this thread was whether the HTTP method should be included in the cache key. See this thread for a complete summary.

If you enjoyed this article, consider subscribing to my journal.