Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

With nginx, latest, is it possible to proxy cache ONLY specific html status code responses?

We use 410 status codes for some responses.

These are checked against our database.

When the said content is flagged as removed for ever (410), a 410 status code is sent.

This content is gone forever.

We would like to proxy cache ONLY these results.

Is this possible?

share|improve this question
up vote 2 down vote accepted

Use proxy_cache_valid directive, e.g.:

proxy_cache_valid 410      1m;
proxy_cache_valid any      0;

share|improve this answer
:) i knew about proxy_cache_valid, we use it for other stuff... but did not know we could pass a 0 value to any to avoid caching :) thanks! – anonymous-one May 16 '12 at 11:44

Your Answer


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.