reverse proxy that caches post requests
I understand that varnish caches "GET" and "HEAD" requests by default.
My backend servers fail when I do a get request that is too long, so I made them respond to POST instead of GET. This works great, but I need a reverse proxy which can be configured to cache POST responses just like GET.
Are there any reverse proxies that can cache these post requests?
It seems nginx does cache POST requests if you specify it.
proxy_cache_methods POST; # GET HEAD proxy_cache_key "$uri|$request_body"; client_max_body_size 10k; # 413
Reverse proxies cache responses, not requests. In any case, it's not realistic to cache a response to a POST request. The HTTP specification really doesn't allow for it, since the very act of sending a POST request is supposed to invalidate any cache for that URL, and the response is non-cacheable by default. You are supposed to send a redirect as a response to the POST request if you want the response cached.