title: Suggestions for extremely aggressive HTTP caching for REST resources
body: <p>I have a setup where I would like to have extremely aggressive HTTP caching on my internal proxy. Basically, what I want to achieve is a simplistic caching strategy like this:</p>
  
  <ul>
  <li>any GET request that does not 500x or 400x gets cached indefinitely</li>
  <li>any PUT or POST or DELETE or PATCH that does not 500x or 400x invalidates the resource and it's subpaths (since I only use nested resources and I use them a lot).</li>
  </ul>
  
  <p>I don't plan to have a ridiculous number of subpaths either (around 1000 per root-level resource, and less and less drilling down obviously).</p>
  
  <p>So basically I want to avoid the absolute most of the requests even touching my core app.</p>
  
  <p>I plan to run the caching backend on a separate machine with lots of RAM and evil storage, and there is going to be one such machine (so I don't have to expire across a cluster or anything like that). </p>
  
  <p>Which proxy cache would be better for this task? Varnish or HAProxy? What are the settings that I should look for to achieve this kind of expiry? Is this a common pattern to make REST servers caching-friendly?</p>