changeset 548:95a970603b0f

Brought the "return" documentation up to date.
author Ruslan Ermilov <ru@nginx.com>
date Sun, 24 Jun 2012 18:58:23 +0000
parents 32dd85720515
children ab1449e0573b
files xml/en/docs/http/ngx_http_rewrite_module.xml xml/ru/docs/http/ngx_http_rewrite_module.xml
diffstat 2 files changed, 78 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_rewrite_module.xml	Sun Jun 24 18:47:05 2012 +0000
+++ b/xml/en/docs/http/ngx_http_rewrite_module.xml	Sun Jun 24 18:58:23 2012 +0000
@@ -167,7 +167,9 @@
 
 
 <directive name="return">
-<syntax><value>code</value></syntax>
+<syntax><value>code</value> [<value>text</value>]</syntax>
+<syntax><value>code</value> <value>URL</value></syntax>
+<syntax><value>URL</value></syntax>
 <default/>
 <context>server</context>
 <context>location</context>
@@ -175,12 +177,41 @@
 
 <para>
 Stops processing and returns the specified <value>code</value> to a client.
-The following codes can be returned: 204, 400,
-402 — 406, 408, 410, 411, 413, 416, and 500 — 504.
-In addition, the non-standard code 444 closes a connection without sending
+The non-standard code 444 closes a connection without sending
 a response header.
 </para>
 
+<para>
+Starting from version 0.8.42, it is possible to specify
+either the URL of redirect (for codes 301, 302, 303, and 307),
+or the <value>text</value> of a response body (for other codes).
+A response body text or URL of redirect can contain variables.
+As a special case, a URL of redirect can be specified as a URI
+local to this server, in which case the full URL of redirect
+is formed according to the request scheme (<var>$scheme</var>) and the
+<link doc="ngx_http_core_module.xml" id="server_name_in_redirect"/> and
+<link doc="ngx_http_core_module.xml" id="port_in_redirect"/> directives.
+</para>
+
+<para>
+In addition, a <value>URL</value> for temporary redirect with the code 302
+can be specified as the sole parameter.
+Such a parameter should start with the string “<literal>http://</literal>”,
+“<literal>https://</literal>”, or “<literal>$scheme</literal>”.
+A <value>URL</value> can contain variables.
+</para>
+
+<para>
+<note>
+Only the following codes could be returned before version 0.7.51:
+204, 400, 402 — 406, 408, 410, 411, 413, 416, and 500 — 504.
+</note>
+
+<note>
+The code 307 was not treated as a redirect until versions 1.1.16 and 1.0.13.
+</note>
+</para>
+
 </directive>
 
 
@@ -235,6 +266,10 @@
 </tag-desc>
 
 </list>
+The full URL of redirects is formed according to the
+request scheme (<var>$scheme</var>) and the
+<link doc="ngx_http_core_module.xml" id="server_name_in_redirect"/> and
+<link doc="ngx_http_core_module.xml" id="port_in_redirect"/> directives.
 </para>
 
 <para>
--- a/xml/ru/docs/http/ngx_http_rewrite_module.xml	Sun Jun 24 18:47:05 2012 +0000
+++ b/xml/ru/docs/http/ngx_http_rewrite_module.xml	Sun Jun 24 18:58:23 2012 +0000
@@ -166,7 +166,9 @@
 
 
 <directive name="return">
-<syntax><value>код</value></syntax>
+<syntax><value>код</value> [<value>текст</value>]</syntax>
+<syntax><value>код</value> <value>URL</value></syntax>
+<syntax><value>URL</value></syntax>
 <default/>
 <context>server</context>
 <context>location</context>
@@ -174,12 +176,41 @@
 
 <para>
 Завершает обработку и возвращает клиенту указанный <value>код</value>.
-Можно возвращать следующие коды: 204, 400,
-402 — 406, 408, 410, 411, 413, 416 и 500 — 504.
-Кроме того, нестандартный код 444 закрывает соединение без передачи
+Нестандартный код 444 закрывает соединение без передачи
 заголовка ответа.
 </para>
 
+<para>
+Начиная с версии 0.8.42 можно задать
+либо URL перенаправления (для кодов 301, 302, 303 и 307),
+либо <value>текст</value> тела ответа (для остальных кодов).
+В тексте тела ответа и URL перенаправления можно использовать переменные.
+Как частный случай, URL перенаправления может быть задан как URI,
+локальный для данного сервера, при этом полный URL перенаправления
+формируется согласно схеме запроса (<var>$scheme</var>) и директив
+<link doc="ngx_http_core_module.xml" id="server_name_in_redirect"/> и
+<link doc="ngx_http_core_module.xml" id="port_in_redirect"/>.
+</para>
+
+<para>
+Кроме того, в качестве единственного параметра можно указать
+<value>URL</value> для временного перенаправления с кодом 302.
+Такой параметр должен начинаться со строк “<literal>http://</literal>”,
+“<literal>https://</literal>” или “<literal>$scheme</literal>”.
+В <value>URL</value> можно использовать переменные.
+</para>
+
+<para>
+<note>
+До версии 0.7.51 можно было возвращать только следующие коды:
+204, 400, 402 — 406, 408, 410, 411, 413, 416 и 500 — 504.
+</note>
+
+<note>
+До версий 1.1.16 и 1.0.13 код 307 не обрабатывался как перенаправление.
+</note>
+</para>
+
 </directive>
 
 
@@ -234,6 +265,10 @@
 </tag-desc>
 
 </list>
+Полный URL перенаправлений формируется согласно
+схеме запроса (<var>$scheme</var>) и директив
+<link doc="ngx_http_core_module.xml" id="server_name_in_redirect"/> и
+<link doc="ngx_http_core_module.xml" id="port_in_redirect"/>.
 </para>
 
 <para>