Elias,

On 6/2/21 12:16 PM, Elias Abacioglu wrote:
I'm planning on placing an API behind HAProxy and want a way to modify the
times/intervals in the POST data to increase cacheability to the API.

While POST requests may in fact be cached under certain circumstances as I learned 2 minutes ago, it is certainly very unusual and also not supported by HAProxy's cache.

   Responses to POST requests are only cacheable when they include
   explicit freshness information (see Section 4.2.1 of [RFC7234]).
   However, POST caching is not widely implemented.  For cases where an
   origin server wishes the client to be able to cache the result of a
   POST in a way that can be reused by a later GET, the origin server
   MAY send a 200 (OK) response containing the result and a
   Content-Location header field that has the same value as the POST's
   effective request URI (Section 3.1.4.2).

I would advise against caching POST requests and instead move the parameters into the URL or a request header (make sure to set 'Vary' on the response) and instead use a GET request.

Best regards
Tim Düsterhus

Reply via email to