My nginx server acts as a proxy for another server, which sometimes returns 404s.
I want the 404 responses to be cacheable, just like 200 responses.
However, I cannot use expires
, because the documentation states that:
expires
works only for 200, 204, 301, 302, and 304 responses.
Note that caching of non-200 responses is perfectly possible according to the HTTP spec.
So how can I set an expiration date on 404 responses?