Forced caching

Hi,
what is the easiest way to force all request to be satisfied from the
cache
for lets say a minute? What I’m basically trying to do is to rate-limit
the
requests to the proxy upstream so that the upstream server will see no
more
than for example one request per minute for a specific url.

Regards,
Dennis

I am sure there is a better way but here is a suggestion. Use the rate
limit to identify when there is more than one connection per minute and
redirect that to the cache, if it doesnt hit that limit then you can use
the
cache_bypass. Not sure if this would work hope someone can confirm,
but a
thought.

limit_req_zone  $binary_remote_addr  zone=one:10m   rate=1r/m;

location / {

      limit_req zone=one burst=1 nodelay;
      error_page 503  = @cached;

set $http_my_secret_header “0”; proxy_cache_bypass
$http_my_secret_header;

    location @cached {

proxy_pass
}

Rami
On Tue, Jul 26, 2011 at 5:55 AM, Dennis J. <

There’s an attribute “updating” for proxy_cache_use_stale. I think
that’s what you need.

http://wiki.nginx.org/HttpProxyModule

  • Z

On Tue, 26 Jul 2011 11:55:35 +0200
Dennis J. [email protected] wrote:

nginx mailing list
[email protected]
nginx Info Page


Zeljko T. [email protected]