Reputation: 2307
I have a nginx server that is acting as a proxy to a 3rd party API, requests to the API can be a bit slow sometimes and pages that rely on the slower API calls can take a long time to load when the items in the cache have expired.
Is there anyway to have something similar to the following happen:
The crucial thing is when nginx retrieves the fresh content it does so after serving the stale content and so the user making the request doesn't have to wait for it to complete.
Is that possible?
Upvotes: 2
Views: 4258
Reputation: 441
I think the closest possible behaviour will be the next:
This behaviour can be enabled by proxy_cache_use_stale updating
.
Please see proxy_cache_use_stale documentation for more. You also may be interested in proxy_cache_lock
Source: NGINX caching webinar and notes
Actually, the behaviour that is mentioned in the question is supported by NGINX. Sorry for the incorrect answer. Please see: https://stackoverflow.com/a/40134179/1079966
Upvotes: 2