Cache POST Responses

Enable caching of POST responses.

How it works

By default, a response to a POST request is passed to the origin. With this behavior enabled, you can override the default, and cache POST responses. To use this behavior, you must enable the Allow POST behavior.

📘

To cache a POST response with this feature, the POST request can't exceed 16 kilobytes in size.

Features and options

FieldWhat it doesSub-options

Status

Enables or disables the behavior.

POST Body

Define whether and how the POST message body is used for the cache key.

  • Ignore in cache key. Uses only the URL to cache the response.

  • Include an MD5 hash in cache key. Adds a string digest of the data as a query parameter to the cache URL.

  • Include as a query parameter in cache key. Adds the raw request body as a query parameter to the cache key, but only if the POST request’s Content-Type is application/x-www-form-urlencoded. Use this in conjunction with Cache ID Modification to define relevant query parameters.

Related topics

See Allow POST and Cache ID Modification.