Please try the following patch:
# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1502813238 -10800
# Tue Aug 15 19:07:18 2017 +0300
# Node ID d51ee844db963d4c51ea1d9eed335af19c95f43a
# Parent a2f5e25d6a283546f76435b9fc3e7e814b092bae
Upstream: unconditional parsing of last_modified_time.
This fixes at least the following cases, where no last_modified_time
(assuming caching is not enabled) resulted in incorrect behaviour:
- slice filter and If-Range requests (ticket #1357);
- If-Range requests with proxy_force_ranges;
- expires modified.
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -4390,15 +4390,8 @@ ngx_http_upstream_process_last_modified(
u = r->upstream;
u->headers_in.last_modified = h;
-
-#if (NGX_HTTP_CACHE)
-
- if (u->cacheable) {
- u->headers_in.last_modified_time = ngx_parse_http_time(h->value.data,
- h->value.len);
- }
-
-#endif
+ u->headers_in.last_modified_time = ngx_parse_http_time(h->value.data,
+ h->value.len);
return NGX_OK;
}
@@ -4940,15 +4933,8 @@ ngx_http_upstream_copy_last_modified(ngx
*ho = *h;
r->headers_out.last_modified = ho;
-
-#if (NGX_HTTP_CACHE)
-
- if (r->upstream->cacheable) {
- r->headers_out.last_modified_time =
+ r->headers_out.last_modified_time =
r->upstream->headers_in.last_modified_time;
- }
-
-#endif
return NGX_OK;
}