diff -r 19a54ba76c04 src/http/modules/ngx_http_slice_filter_module.c
--- a/src/http/modules/ngx_http_slice_filter_module.c	Wed May 11 17:55:30 2016 +0300
+++ b/src/http/modules/ngx_http_slice_filter_module.c	Wed May 11 16:34:47 2016 +0100
@@ -96,6 +96,20 @@
 static ngx_http_output_body_filter_pt    ngx_http_next_body_filter;
 
 
+static ngx_http_slice_ctx_t *
+ngx_http_slice_getctx(ngx_http_request_t *r)
+{
+    ngx_http_slice_ctx_t *ctx;
+
+    ctx = ngx_http_get_module_ctx(r, ngx_http_slice_filter_module);
+    if (ctx == NULL && r != r->main) {
+        ngx_http_request_t *p = r->parent;
+        return ngx_http_get_module_ctx(p, ngx_http_slice_filter_module);
+    }
+    return ctx;
+}
+
+
 static ngx_int_t
 ngx_http_slice_header_filter(ngx_http_request_t *r)
 {
@@ -106,7 +120,7 @@
     ngx_http_slice_loc_conf_t       *slcf;
     ngx_http_slice_content_range_t   cr;
 
-    ctx = ngx_http_get_module_ctx(r, ngx_http_slice_filter_module);
+    ctx = ngx_http_slice_getctx(r);
     if (ctx == NULL) {
         return ngx_http_next_header_filter(r);
     }
@@ -213,7 +227,7 @@
     ngx_http_slice_ctx_t       *ctx;
     ngx_http_slice_loc_conf_t  *slcf;
 
-    ctx = ngx_http_get_module_ctx(r, ngx_http_slice_filter_module);
+    ctx = ngx_http_slice_getctx(r);
 
     if (ctx == NULL || r != r->main) {
         return ngx_http_next_body_filter(r, in);
@@ -248,8 +262,6 @@
         return NGX_ERROR;
     }
 
-    ngx_http_set_ctx(sr, ctx, ngx_http_slice_filter_module);
-
     slcf = ngx_http_get_module_loc_conf(r, ngx_http_slice_filter_module);
 
     ctx->range.len = ngx_sprintf(ctx->range.data, "bytes=%O-%O", ctx->start,
@@ -375,7 +387,7 @@
     ngx_http_slice_ctx_t       *ctx;
     ngx_http_slice_loc_conf_t  *slcf;
 
-    ctx = ngx_http_get_module_ctx(r, ngx_http_slice_filter_module);
+    ctx = ngx_http_slice_getctx(r);
 
     if (ctx == NULL) {
         if (r != r->main || r->headers_out.status) {
