How to cache a POST request

Hello there.

I would like to know what is the easiest way to cache a POST request.

I am building an app that performs heavy pooling and I would like to minimize the amount of requests that hits my server. In other words, I would like to cache the request using Cloudflare.

More details:

  1. The POST request has a list of integers as the main parameter and I wanna use this list as the “key” of the cache.
  2. I want the TTL of the cache to be set as 5 seconds

Thank you,
Igor

(I presume you mean responses, not requests). You can configure POST responses to be cached using Workers. There is an example here:
https://developers.cloudflare.com/workers/examples/cache-post-request

2 Likes

Thanks Michael I will check it out.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.