# HG changeset patch # User Egor Nikitin # Date 1375855859 -14400 # Node ID fbb4cc6f8c3ddcdbc2865a1ddf706329e572fc86 # Parent fd1f8e0a405ee492bb7d103a5442f151b3b64fdb Text review of ngx_http_proxy_module. diff -r fd1f8e0a405e -r fbb4cc6f8c3d xml/en/docs/http/ngx_http_proxy_module.xml --- a/xml/en/docs/http/ngx_http_proxy_module.xml Tue Aug 06 17:03:33 2013 +0400 +++ b/xml/en/docs/http/ngx_http_proxy_module.xml Wed Aug 07 10:10:59 2013 +0400 @@ -15,7 +15,7 @@
-The ngx_http_proxy_module module allows to pass +The ngx_http_proxy_module module allows passing requests to another server. @@ -48,13 +48,13 @@ 0.8.22 -Forces outgoing connections to a proxied server to originate +Makes outgoing connections to a proxied server to originate from the specified local IP address. Value of the parameter can contain variables (1.3.12). The special value off (1.3.12) cancels the effect of the proxy_bind directive inherited from the previous configuration level, allowing the -system to auto-assign local address. +system to auto-assign the local IP address. @@ -68,7 +68,7 @@ location -Sets size of the buffer used for reading the first part +Sets the size of the buffer used for reading the first part of a response received from the proxied server. This part usually contains a small response header. By default, the buffer size is equal to the size of one @@ -92,11 +92,11 @@ When buffering is enabled, nginx receives a response from the proxied server -as soon as possible, saving it into buffers set by the +as soon as possible, saving it into the buffers set by the and directives. -If the whole response does not fit into memory, part of it can be saved -to a temporary file on disk. -Writes to temporary files are controlled by the +If the whole response does not fit into memory, a part of it can be saved +to a temporary file on the disk. +Writing to temporary files is controlled by the and directives. @@ -113,7 +113,7 @@ Buffering can also be enabled or disabled by passing “yes” or “no” in the
X-Accel-Buffering
response header field. -This ability can be disabled using the +This capability can be disabled using the directive.
@@ -152,7 +152,7 @@ yet fully read. In the mean time, the rest of the buffers can be used for reading a response and, if needed, buffering part of a response to a temporary file. -By default, size is limited by two buffers set by the +By default, size is limited by the size of two buffers set by the and directives. @@ -231,7 +231,7 @@ a new cache element identified according to the directive by passing a request to a proxied server. Other requests of the same cache element will either wait -for a response to appear in the cache, or the cache lock for +for a response to appear in the cache or the cache lock for this element to be released, up to the time set by the directive. @@ -306,7 +306,7 @@ http -Sets path and other parameters of a cache. +Sets the path and other parameters of a cache. Cache data are stored in files. Both the key and file name in a cache are a result of applying the MD5 function to the proxied URL. @@ -323,12 +323,13 @@ -A cached response is first written to a temporary file, then a file is renamed. -Starting from version 0.8.9 temporary files and the cache can be put on -different file systems but be aware that in this case a file is copied -across two file systems instead of the cheap rename operation. +A cached response is first written to a temporary file, +then the file is renamed. +Starting from version 0.8.9, temporary files and the cache can be put on +different file systems, but be aware that in this case a file is copied +across two file systems instead of the cheap renaming operation. It is thus recommended that for any given location both cache and a directory -holding temporary files set by the directive +holding temporary files, set by the directive, are put on the same file system. @@ -343,22 +344,22 @@ -The special process “cache manager” monitors the maximum cache size set -by the max_size parameter; -when this size is exceeded it removes the least recently used data. +The special “cache manager” process monitors the maximum cache size set +by the max_size parameter. +When this size is exceeded, it removes the least recently used data. -A minute after the start the special process “cache loader” is activated -that loads information about previously cached data stored on file system +A minute after the start the special “cache loader” process is activated. +It loads information about previously cached data stored on file system into a cache zone. -A load is done in iterations. +The loading is done in iterations. During one iteration no more than loader_files items are loaded (by default, 100). Besides, the duration of one iteration is limited by the loader_threshold parameter (by default, 200 milliseconds). -A pause is made between iterations, configured by the -loader_sleep parameter (by default, 50 milliseconds). +Between iterations, a pause configured by the loader_sleep +parameter (by default, 50 milliseconds) is made. @@ -384,17 +385,16 @@ location -If an error occurs while working with the proxied server it is possible -to use a stale cached response. -This directives determines in which cases it is permitted. -The directive’s parameters match those of the +Determines in which cases a stale cached response can be used +when an error occurs in working with the proxied server. +The directive’s parameters match the parameters of the directive. Additionally, the updating parameter permits -to use a stale cached response if it is currently being updated. -This allows to minimize the number of accesses to proxied servers +using a stale cached response if it is currently being updated. +This allows minimizing the number of accesses to proxied servers when updating cached data. @@ -434,8 +434,8 @@ -In addition, it can be specified to cache any responses using the -any parameter: +In addition, the any parameter can be specified +to cache any responses: proxy_cache_valid 200 302 10m; proxy_cache_valid 301 1h; @@ -446,11 +446,11 @@ Parameters of caching can also be set directly in the response header. -This has a higher precedence than setting of caching time using the directive. +This has higher priority than setting of caching time using the directive. The
X-Accel-Expires
header field sets caching time of a response in seconds. -The value 0 disables to cache a response. -If a value starts with the prefix @, it sets an absolute +The 0 value disables caching for a response. +If a value starts with the @ prefix, it sets an absolute time in seconds since Epoch, up to which the response may be cached. If header does not include the
X-Accel-Expires
field, parameters of caching may be set in the header fields @@ -472,7 +472,7 @@ location -Defines a timeout for establishing a connection with the proxied server. +Defines a timeout for establishing a connection with a proxied server. It should be noted that this timeout cannot usually exceed 75 seconds. @@ -492,8 +492,8 @@ Sets a text that should be changed in the domain attribute of the
Set-Cookie
header fields of a proxied server response. -Suppose a proxied server returned the header field -
Set-Cookie
with the attribute +Suppose a proxied server returned the
Set-Cookie
+header field with the attribute “domain=localhost”. The directive @@ -505,13 +505,13 @@ A dot at the beginning of the domain and -replacement strings, and the domain +replacement strings and the domain attribute is ignored. Matching is case-insensitive. -The strings domain and replacement +The domain and replacement strings can contain variables: proxy_cookie_domain www.$host $host; @@ -519,7 +519,7 @@ -A directive can also be specified using regular expressions. +The directive can also be specified using regular expressions. In this case, domain should start from the “~” symbol. A regular expression can contain named and positional captures, @@ -538,7 +538,7 @@ -The off parameter cancels all +The off parameter cancels the effect of all proxy_cookie_domain directives on the current level: proxy_cookie_domain off; @@ -563,8 +563,8 @@ Sets a text that should be changed in the path attribute of the
Set-Cookie
header fields of a proxied server response. -Suppose a proxied server returned the header field -
Set-Cookie
with the attribute +Suppose a proxied server returned the
Set-Cookie
+header field with the attribute “path=/two/some/uri/”. The directive @@ -575,7 +575,7 @@
-The strings path and replacement +The path and replacement strings can contain variables: proxy_cookie_path $uri /some$uri; @@ -583,7 +583,7 @@ -A directive can also be specified using regular expressions. +The directive can also be specified using regular expressions. In this case, path should either start from the “~” symbol for a case-sensitive matching, or from the “~*” symbols for case-insensitive @@ -604,7 +604,7 @@ -The off parameter cancels all +The off parameter cancels the effect of all proxy_cookie_path directives on the current level: proxy_cookie_path off; @@ -627,7 +627,7 @@ Sets the bucket size for hash tables used by the and directives. -Details of setting up hash tables are provided in a separate +The details of setting up hash tables are provided in a separate document. @@ -645,7 +645,7 @@ Sets the maximum size of hash tables used by the and directives. -Details of setting up hash tables are provided in a separate +The details of setting up hash tables are provided in a separate document.
@@ -701,8 +701,8 @@ location -Determines should the connection with a proxied server be -closed if a client closes a connection without waiting +Determines whether the connection with a proxied server should be +closed when a client closes a connection without waiting for a response. @@ -726,13 +726,14 @@
-If not disabled, processing of these header fields has the following effect: +If not disabled, processing of these header fields has the following +effect:
X-Accel-Expires
,
Expires
,
Cache-Control
, and
Set-Cookie
-set parameters of response caching; +set the parameters of response caching;
@@ -742,7 +743,7 @@ -
X-Accel-Limit-Rate
sets a +
X-Accel-Limit-Rate
sets the rate limit for transmission of a response to a client;
@@ -774,7 +775,7 @@ Determines whether proxied responses with codes greater than or equal to 300 should be passed to a client or be redirected to nginx for processing -using the directive. +by the directive. @@ -789,16 +790,16 @@ When buffering of responses from the proxied -server is enabled, and the whole response does not fit into memory buffers +server is enabled, and the whole response does not fit into the memory buffers set by the and -directives, part of a response can be saved to a temporary file. +directives, a part of a response can be saved to a temporary file. This directive sets the maximum size of a temporary file. The size of data written to a temporary file at a time is set by the directive. -Value of zero disables buffering of responses to temporary files. +The zero value disables buffering of responses to temporary files. @@ -843,14 +844,14 @@ error an error occurred while establishing a connection with the -server, passing it a request, or reading the response header; +server, passing a request to it, or reading the response header; timeout a timeout has occurred while establishing a connection with the -server, passing it a request, or reading the response header; +server, passing a request to it, or reading the response header; invalid_header -a server returned empty or invalid response; +a server returned an empty or invalid response; http_500 a server returned a response with the code 500; @@ -877,10 +878,10 @@
-It should be understood that passing a request to the next server is -only possible if a client was not sent anything yet. -That is, if an error or a timeout occurs in the middle of -transferring a response, fixing this is impossible. +One should bear in mind that passing a request to the next server is +only possible if nothing has been sent to a client yet. +That is, if an error or timeout occurs in the middle of the +transferring of a response, fixing this is impossible. @@ -929,11 +930,11 @@ limit_except -Sets the protocol and address of a proxied server, and an optional URI +Sets the protocol and address of a proxied server and an optional URI to which a location should be mapped. -A protocol can be specified as -“http” or “https”. -An address can be specified as a domain name or IP address, +As a protocol, “http” or “https” +can be specified. +The address can be specified as a domain name or IP address, and an optional port: proxy_pass http://localhost:8000/uri/; @@ -957,8 +958,8 @@ -If proxy_pass is specified with URI, -when passing a request to the server, part of a +If the proxy_pass directive is specified with a URI, +then when a request is passed to the server, the part of a normalized request URI matching the location is replaced by a URI specified in the directive: @@ -970,9 +971,9 @@ -If proxy_pass is specified without URI, -a request URI is passed to the server in the same form -as sent by a client when processing an original request, +If proxy_pass is specified without a URI, +the request URI is passed to the server in the same form +as sent by a client when the original request is processed, or the full normalized request URI is passed when processing the changed URI: @@ -983,7 +984,7 @@ Before version 1.1.12, if proxy_pass is specified without a URI, -an original request URI might be passed +the original request URI might be passed instead of the changed URI in some cases. @@ -991,18 +992,18 @@ -In some cases, part of a request URI to be replaced cannot be determined: +In some cases, the part of a request URI to be replaced cannot be determined: When location is specified using a regular expression. -In this case, the directive should be specified without URI. +In this case, the directive should be specified without a URI. -When URI is changed inside a proxied location using the +When the URI is changed inside a proxied location using the directive, and this same configuration will be used to process a request (break): @@ -1013,7 +1014,7 @@ } -In this case, a URI specified in the directive is ignored and +In this case, the URI specified in the directive is ignored and the full changed request URI is passed to the server. @@ -1021,7 +1022,8 @@ -A server name, its port and passed URI can also be specified using variables: +A server name, its port and the passed URI can also be specified using +variables: proxy_pass http://$host$uri; @@ -1032,9 +1034,9 @@ -In this case the server name is searched among the described +In this case, the server name is searched among the described server groups, -and if not found is determined using a +and, if not found, is determined using a . @@ -1054,7 +1056,7 @@ location -Permits to pass otherwise disabled header +Permits passing otherwise disabled header fields from a proxied server to a client. @@ -1087,7 +1089,7 @@ location -If disabled, the original request body will not be passed +Allows disabling a passing of the original request body to the proxied server. location /x-accel-redirect-here/ { @@ -1113,8 +1115,8 @@ location -If disabled, header fields of the original request will not be passed to the -proxied server. +Allows disabling a passing of the header fields of the original request +to the proxied server. location /x-accel-redirect-here/ { proxy_method GET; @@ -1141,9 +1143,8 @@ location -Sets a text that should be changed in the header fields -
Location
and
Refresh
of a response -from the proxied server. +Sets the text that should be changed in the
Location
+and
Refresh
header fields of a proxied server response. Suppose a proxied server returned the header field “Location: http://localhost:8000/two/some/uri/”. The directive @@ -1155,12 +1156,12 @@
-A server name may be omitted from the replacement string: +A server name may be omitted in the replacement string: proxy_redirect http://localhost:8000/two/ /; -then the primary server’s name and a port, if different from 80, -will be substituted. +then the primary server’s name and port, if different from 80, +will be inserted. @@ -1199,10 +1200,10 @@ -A directive can be specified (1.1.11) using regular expressions. -In this case, redirect should either start from +The directive can be specified (1.1.11) using regular expressions. +In this case, redirect should either start with the “~” symbol for a case-sensitive matching, -or from the “~*” symbols for case-insensitive +or with the “~*” symbols for case-insensitive matching. A regular expression can contain named and positional captures, and replacement can reference them: @@ -1222,7 +1223,7 @@ -The off parameter cancels all +The off parameter cancels the effect of all proxy_redirect directives on the current level: proxy_redirect off; @@ -1233,7 +1234,7 @@ -Using this directive it is also possible to add host names to relative +Using this directive, it is also possible to add host names to relative redirects issued by a proxied server: proxy_redirect / /; @@ -1251,7 +1252,8 @@ location -If set to a non-zero value, nginx will try to minimize the number +If the directive is set to a non-zero value, nginx will try to +minimize the number of send operations on outgoing connections to a proxied server by using either NOTE_LOWAT flag of the method, @@ -1292,7 +1294,7 @@ location -Allows to redefine request body passed to the proxied server. +Allows redefining the request body passed to the proxied server. A value can contain text, variables, and their combination. @@ -1308,9 +1310,9 @@ location -Allows to redefine or append fields to the request header +Allows redefining or appending fields to the request header passed to the proxied server. -A value can contain text, variables, and their combination. +A value can contain text, variables, and their combinations. These directives are inherited from the previous level if and only if there are no proxy_set_header @@ -1334,14 +1336,14 @@ nothing will be passed. In such a case it is better to use the $host variable—its value equals the server name in the
Host
request header -field, or the primary server name if this field is not present: +field or the primary server name if this field is not present: proxy_set_header Host $host;
-In addition, a server name can be passed together with a port of the +In addition, the server name can be passed together with the port of the proxied server: proxy_set_header Host $host:$proxy_port; @@ -1371,7 +1373,7 @@ the proxied server. If the errors “SSL3_GET_FINISHED:digest check failed” -appear in the logs, try to disable session reuse. +appear in the logs, try disabling session reuse. @@ -1405,9 +1407,10 @@ The modification time of files is set according to the received
Last-Modified
response header field. A response is first written to a temporary file, then a file is renamed. -Starting from version 0.8.9 temporary files and the persistent store -can be put on different file systems but be aware that in this case -a file is copied across two file systems instead of the cheap rename operation. +Starting from version 0.8.9, temporary files and the persistent store +can be put on different file systems, but be aware that in this case +a file is copied across two file systems instead of the cheap renaming +operation. It is thus recommended that for any given location both saved files and a directory holding temporary files set by the directive are put on the same file system. diff -r fd1f8e0a405e -r fbb4cc6f8c3d xml/ru/docs/http/ngx_http_proxy_module.xml --- a/xml/ru/docs/http/ngx_http_proxy_module.xml Tue Aug 06 17:03:33 2013 +0400 +++ b/xml/ru/docs/http/ngx_http_proxy_module.xml Wed Aug 07 10:10:59 2013 +0400 @@ -54,7 +54,7 @@ Специальное значение off (1.3.12) отменяет действие унаследованной с предыдущего уровня конфигурации директивы proxy_bind, позволяя системе -самостоятельно выбирать локальный адрес. +самостоятельно выбирать локальный IP-адрес.
@@ -151,7 +151,7 @@ ответ ещё не прочитан целиком. Оставшиеся буферы тем временем могут использоваться для чтения ответа и, при необходимости, буферизации части ответа во временный файл. -По умолчанию размер ограничен двумя буферами, заданными +По умолчанию размер ограничен величиной двух буферов, заданных директивами и .
@@ -535,7 +535,7 @@
-Параметр off запрещает все директивы +Параметр off отменяет действие всех директив proxy_cookie_domain на данном уровне: @@ -601,7 +601,7 @@ -Параметр off запрещает все директивы +Параметр off отменяет действие всех директив proxy_cookie_path на данном уровне: @@ -789,12 +789,12 @@ заданные директивами и , часть ответа может быть записана во временный файл. Эта директива задаёт максимальный размер временного файла. -Размер данных, сбрасываемых во временный файл за один раз, задаётся +Размер данных, записываемых во временный файл за один раз, задаётся директивой . -Значение 0 отключает возможность буферизации ответов во временные файлы. +Значение 0 отключает буферизацию ответов во временные файлы. @@ -876,8 +876,8 @@ Необходимо понимать, что передача запроса следующему серверу возможна только при условии, что клиенту ещё ничего не передавалось. -То есть, если ошибка или таймаут возникли в середине передачи ответа, -то исправить это уже невозможно. +То есть, если ошибка или таймаут возникли в середине передачи ответа +клиенту, то исправить это уже невозможно. @@ -953,7 +953,7 @@ -Если proxy_pass указана с URI, +Если директива proxy_pass указана с URI, то при передаче запроса серверу часть нормализованного URI запроса, соответствующая location, заменяется на URI, @@ -966,7 +966,7 @@ -Если proxy_pass указана без URI, +Если директива proxy_pass указана без URI, то при обработке первоначального запроса на сервер передаётся URI запроса в том же виде, в каком его прислал клиент, а при обработке изменённого URI— @@ -1084,7 +1084,7 @@ location -Если запрещено, то исходное тело запроса не будет передано +Позволяет запретить передачу исходного тела запроса на проксируемый сервер. location /x-accel-redirect-here/ { @@ -1110,7 +1110,7 @@ location -Если запрещено, то поля заголовка исходного запроса не будут переданы на +Позволяет запретить передачу полей заголовка исходного запроса на проксируемый сервер. location /x-accel-redirect-here/ { @@ -1156,7 +1156,7 @@ proxy_redirect http://localhost:8000/two/ /; -тогда будет подставлено основное имя сервера и порт, если он отличен от 80. +тогда будут подставлены основное имя сервера и порт, если он отличен от 80.