summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2023-01-24 03:01:51 +0300
committerMaxim Dounin <mdounin@mdounin.ru>2023-01-24 03:01:51 +0300
commit5c18b5bc3fe14aac969d1fb1e383bc696932e1f5 (patch)
treef2c859b06a7f3f6a69f65ed616687230777f7975
parentee00085f5cc655e362337684bf82dbe926d4b885 (diff)
downloadnginx-5c18b5bc3fe14aac969d1fb1e383bc696932e1f5.tar.gz
Gzip static: ranges support (ticket #2349).
In contrast to on-the-fly gzipping with gzip filter, static gzipped representation as returned by gzip_static is persistent, and therefore the same binary representation is available for future requests, making it possible to use range requests. Further, if a gzipped representation is re-generated with different compression settings, it is expected to result in different ETag and different size reported in the Content-Range header, making it possible to safely use range requests anyway. As such, ranges are now allowed for files returned by gzip_static.
-rw-r--r--src/http/modules/ngx_http_gzip_static_module.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/http/modules/ngx_http_gzip_static_module.c b/src/http/modules/ngx_http_gzip_static_module.c
index 66fcc5d1b..0ab14636e 100644
--- a/src/http/modules/ngx_http_gzip_static_module.c
+++ b/src/http/modules/ngx_http_gzip_static_module.c
@@ -247,6 +247,8 @@ ngx_http_gzip_static_handler(ngx_http_request_t *r)
ngx_str_set(&h->value, "gzip");
r->headers_out.content_encoding = h;
+ r->allow_ranges = 1;
+
/* we need to allocate all before the header would be sent */
b = ngx_calloc_buf(r->pool);