aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/http/ngx_http_upstream.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
index b3580fea1..985d633e0 100644
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -2528,13 +2528,23 @@ ngx_http_upstream_intercept_errors(ngx_http_request_t *r,
#if (NGX_HTTP_CACHE)
if (r->cache) {
- time_t valid;
- valid = ngx_http_file_cache_valid(u->conf->cache_valid, status);
+ if (u->cacheable) {
+ time_t valid;
- if (valid) {
- r->cache->valid_sec = ngx_time() + valid;
- r->cache->error = status;
+ valid = r->cache->valid_sec;
+
+ if (valid == 0) {
+ valid = ngx_http_file_cache_valid(u->conf->cache_valid,
+ status);
+ if (valid) {
+ r->cache->valid_sec = ngx_time() + valid;
+ }
+ }
+
+ if (valid) {
+ r->cache->error = status;
+ }
}
ngx_http_file_cache_free(r->cache, u->pipe->temp_file);