Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_slice_module.xml @ 1616:9e8ec9c67cf3
Documented ngx_http_slice_module.
author | Yaroslav Zhuravlev <yar@nginx.com> |
---|---|
date | Tue, 08 Dec 2015 18:53:15 +0300 |
parents | |
children | 51e1c73cc027 |
comparison
equal
deleted
inserted
replaced
1615:a1531068d436 | 1616:9e8ec9c67cf3 |
---|---|
1 <?xml version="1.0"?> | |
2 | |
3 <!-- | |
4 Copyright (C) Nginx, Inc. | |
5 --> | |
6 | |
7 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | |
8 | |
9 <module name="Module ngx_http_slice_module" | |
10 link="/en/docs/http/ngx_http_slice_module.html" | |
11 lang="en" | |
12 rev="1"> | |
13 | |
14 <section id="summary"> | |
15 | |
16 <para> | |
17 The <literal>ngx_http_slice_module</literal> module (1.9.8) is a filter | |
18 that splits a request into subrequests, | |
19 each returning a certain range of response. | |
20 The filter provides more effective caching of big responses. | |
21 </para> | |
22 | |
23 <para> | |
24 This module is not built by default, it should be enabled with the | |
25 <literal>--with-http_slice_module</literal> | |
26 configuration parameter. | |
27 </para> | |
28 | |
29 </section> | |
30 | |
31 | |
32 <section id="example" name="Example Configuration"> | |
33 | |
34 <para> | |
35 <example> | |
36 location / { | |
37 <emphasis>slice</emphasis> 1m; | |
38 proxy_cache cache; | |
39 proxy_cache_key $uri$is_args$args<emphasis>$slice_range</emphasis>; | |
40 proxy_set_header Range <emphasis>$slice_range</emphasis>; | |
41 proxy_cache_valid 200 206 1h; | |
42 proxy_pass http://localhost:8000; | |
43 } | |
44 </example> | |
45 In this example, | |
46 the response is split into 1-megabyte cacheable slices. | |
47 </para> | |
48 | |
49 </section> | |
50 | |
51 | |
52 <section id="directives" name="Directives"> | |
53 | |
54 | |
55 <directive name="slice"> | |
56 <syntax><literal>size</literal></syntax> | |
57 <default>0</default> | |
58 <context>http</context> | |
59 <context>server</context> | |
60 <context>location</context> | |
61 | |
62 <para> | |
63 Sets the <value>size</value> of the slice. | |
64 The zero value disables splitting responses into slices. | |
65 Note that a too low value may result in excessive memory usage | |
66 and a large number of file descriptors. | |
67 </para> | |
68 | |
69 <para> | |
70 In order for a subrequest to return the required range, | |
71 the <var>$slice_range</var> variable should be | |
72 <link doc="ngx_http_proxy_module.xml" id="proxy_set_header">passed</link> to | |
73 the proxied server as the <literal>Range</literal> request header field. | |
74 If | |
75 <link doc="ngx_http_proxy_module.xml" id="proxy_cache">caching</link> | |
76 is enabled, <var>$slice_range</var> should be added to the | |
77 <link doc="ngx_http_proxy_module.xml" id="proxy_cache_key">cache key</link> | |
78 and caching of responses with 206 status code should be | |
79 <link doc="ngx_http_proxy_module.xml" id="proxy_cache_valid">enabled</link>. | |
80 </para> | |
81 | |
82 </directive> | |
83 | |
84 </section> | |
85 | |
86 | |
87 <section id="variables" name="Embedded Variables"> | |
88 | |
89 <para> | |
90 The <literal>ngx_http_slice_module</literal> module | |
91 supports the following embedded variables: | |
92 <list type="tag"> | |
93 | |
94 <tag-name id="var_slice_range"><var>$slice_range</var></tag-name> | |
95 <tag-desc> | |
96 the current slice range in | |
97 <link url="https://tools.ietf.org/html/rfc7233#section-2.1">HTTP | |
98 byte range</link> format, | |
99 for example, <literal>bytes=0-1048575</literal>. | |
100 | |
101 </tag-desc> | |
102 | |
103 </list> | |
104 </para> | |
105 | |
106 </section> | |
107 | |
108 </module> |