mirror of
https://github.com/nginx/nginx.git
synced 2025-02-25 18:55:26 -06:00
Slice filter.
Splits a request into subrequests, each providing a specific range of response.
The variable "$slice_range" must be used to set subrequest range and proper
cache key. The directive "slice" sets slice size.
The following example splits requests into 1-megabyte cacheable subrequests.
server {
listen 8000;
location / {
slice 1m;
proxy_cache cache;
proxy_cache_key $uri$is_args$args$slice_range;
proxy_set_header Range $slice_range;
proxy_cache_valid 200 206 1h;
proxy_pass http://127.0.0.1:9000;
}
}
This commit is contained in:
15
auto/modules
15
auto/modules
@@ -73,6 +73,11 @@ if [ $HTTP_SSI = YES ]; then
|
||||
fi
|
||||
|
||||
|
||||
if [ $HTTP_SLICE = YES ]; then
|
||||
HTTP_POSTPONE=YES
|
||||
fi
|
||||
|
||||
|
||||
if [ $HTTP_ADDITION = YES ]; then
|
||||
HTTP_POSTPONE=YES
|
||||
fi
|
||||
@@ -110,6 +115,7 @@ fi
|
||||
# ngx_http_copy_filter
|
||||
# ngx_http_range_body_filter
|
||||
# ngx_http_not_modified_filter
|
||||
# ngx_http_slice_filter
|
||||
|
||||
HTTP_FILTER_MODULES="$HTTP_WRITE_FILTER_MODULE \
|
||||
$HTTP_HEADER_FILTER_MODULE \
|
||||
@@ -179,6 +185,12 @@ if [ $HTTP_USERID = YES ]; then
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_USERID_SRCS"
|
||||
fi
|
||||
|
||||
if [ $HTTP_SLICE = YES ]; then
|
||||
HTTP_SRCS="$HTTP_SRCS $HTTP_SLICE_SRCS"
|
||||
else
|
||||
HTTP_SLICE_FILTER_MODULE=""
|
||||
fi
|
||||
|
||||
|
||||
if [ $HTTP_V2 = YES ]; then
|
||||
have=NGX_HTTP_V2 . auto/have
|
||||
@@ -461,7 +473,8 @@ if [ $HTTP = YES ]; then
|
||||
$HTTP_AUX_FILTER_MODULES \
|
||||
$HTTP_COPY_FILTER_MODULE \
|
||||
$HTTP_RANGE_BODY_FILTER_MODULE \
|
||||
$HTTP_NOT_MODIFIED_FILTER_MODULE"
|
||||
$HTTP_NOT_MODIFIED_FILTER_MODULE \
|
||||
$HTTP_SLICE_FILTER_MODULE"
|
||||
|
||||
NGX_ADDON_DEPS="$NGX_ADDON_DEPS \$(HTTP_DEPS)"
|
||||
fi
|
||||
|
||||
@@ -71,6 +71,7 @@ HTTP_ACCESS=YES
|
||||
HTTP_AUTH_BASIC=YES
|
||||
HTTP_AUTH_REQUEST=NO
|
||||
HTTP_USERID=YES
|
||||
HTTP_SLICE=NO
|
||||
HTTP_AUTOINDEX=YES
|
||||
HTTP_RANDOM_INDEX=NO
|
||||
HTTP_STATUS=NO
|
||||
@@ -226,6 +227,7 @@ do
|
||||
--with-http_random_index_module) HTTP_RANDOM_INDEX=YES ;;
|
||||
--with-http_secure_link_module) HTTP_SECURE_LINK=YES ;;
|
||||
--with-http_degradation_module) HTTP_DEGRADATION=YES ;;
|
||||
--with-http_slice_module) HTTP_SLICE=YES ;;
|
||||
|
||||
--without-http_charset_module) HTTP_CHARSET=NO ;;
|
||||
--without-http_gzip_module) HTTP_GZIP=NO ;;
|
||||
@@ -394,6 +396,7 @@ cat << END
|
||||
--with-http_random_index_module enable ngx_http_random_index_module
|
||||
--with-http_secure_link_module enable ngx_http_secure_link_module
|
||||
--with-http_degradation_module enable ngx_http_degradation_module
|
||||
--with-http_slice_module enable ngx_http_slice_module
|
||||
--with-http_stub_status_module enable ngx_http_stub_status_module
|
||||
|
||||
--without-http_charset_module disable ngx_http_charset_module
|
||||
|
||||
@@ -360,6 +360,10 @@ HTTP_USERID_FILTER_MODULE=ngx_http_userid_filter_module
|
||||
HTTP_USERID_SRCS=src/http/modules/ngx_http_userid_filter_module.c
|
||||
|
||||
|
||||
HTTP_SLICE_FILTER_MODULE=ngx_http_slice_filter_module
|
||||
HTTP_SLICE_SRCS=src/http/modules/ngx_http_slice_filter_module.c
|
||||
|
||||
|
||||
HTTP_REALIP_MODULE=ngx_http_realip_module
|
||||
HTTP_REALIP_SRCS=src/http/modules/ngx_http_realip_module.c
|
||||
|
||||
|
||||
Reference in New Issue
Block a user