Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

For normal public pages & js I do a

proxy_cache             assets;
proxy_cache_key         backend$request_uri;
proxy_cache_valid       200 302 100d;
proxy_cache_valid  404      1m;
proxy_cache_use_stale   error timeout invalid_header;

to cache content.

Is there a per user or IP based caching mechanism that will allow me to cache content.

My primary intention is cache pages for a user for short durations like 30 seconds or a minute maximum to prevent fast refreshes.

I understand the implication with NAT. But I am fine with it.

share|improve this question
up vote 2 down vote accepted

Just add the appropriate information to the proxy_cache_key. If you want to cache per client address, add $remote_addr or $binary_remote_addr. If you want to differentiate based on a cookie, add $cookie_NAME to the key. You can see a lot of the available variables at .

share|improve this answer

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.