Nginx – reverse proxy that caches post requests

nginxreverse-proxyvarnish

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?

Best Answer

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