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

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

1 Answer 1

up vote 2 down vote accepted

Use proxy_cache_valid directive, e.g.:

proxy_cache_valid 410      1m;
proxy_cache_valid any      0;

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid

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

 
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.