Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
I'm curious why the servers do not fail if you use POST in stead of GET ... If it's because of Varnish' timeout, you can bump the first_byte_timeout and between_bytes_timeout to something that exceed the expected processing time somewhat. It's probably better than tinkering with caching POST requests. –  Kvisle Dec 22 '12 at 0:02

2 Answers 2

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.

share|improve this answer
1  
I wasn't looking for HTTP compliance, just trying to get my back-end servers working. Users won't know about the black magic that goes on inside. –  nurettin Dec 22 '12 at 7:23
up vote 2 down vote accepted

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
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.