In this example, two locations use the same cache but in different ways.
Because responses from the backend1 server rarely change, no cache-control directives are included. Responses are cached the first time a request is made, and remain valid indefinitely.
By contrast, responses to requests served by backend2 change frequently, so they are considered valid for only 1 minute and aren’t cached until the same request is made 3 times. Moreover, if a request matches the conditions defined by the proxy_cache_bypass directive, NGINX Plus immediately passes the request to backend2 without looking for it in the cache.
Example configuration with nginx caching:
In this example, two locations use the same cache but in different ways.
Because responses from the backend1 server rarely change, no cache-control directives are included. Responses are cached the first time a request is made, and remain valid indefinitely.
By contrast, responses to requests served by backend2 change frequently, so they are considered valid for only 1 minute and aren’t cached until the same request is made 3 times. Moreover, if a request matches the conditions defined by the proxy_cache_bypass directive, NGINX Plus immediately passes the request to backend2 without looking for it in the cache.