changeset 679:9888364847b7

Documented status codes in the error_page directive.
author Vladimir Homutov <vl@nginx.com>
date Thu, 13 Sep 2012 08:02:40 +0000
parents 90c27a37f4ed
children c0e05d052196
files xml/en/docs/http/ngx_http_core_module.xml xml/ru/docs/http/ngx_http_core_module.xml
diffstat 2 files changed, 54 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_core_module.xml	Wed Sep 12 11:00:47 2012 +0000
+++ b/xml/en/docs/http/ngx_http_core_module.xml	Thu Sep 13 08:02:40 2012 +0000
@@ -10,7 +10,7 @@
 <module name="Module ngx_http_core_module"
         link="/en/docs/http/ngx_http_core_module.html"
         lang="en"
-        rev="4">
+        rev="5">
 
 <section id="directives" name="Directives">
 
@@ -580,20 +580,20 @@
 <literal>error_page</literal>
 directives on
 the current level.
-A URI value can contain variables.
+A <literal>uri</literal> value can contain variables.
 </para>
 
 <para>
 Example:
 <example>
-error_page 404         /404.html;
-error_page 502 503 504 /50x.html;
-error_page 403         http://example.com/forbidden.html;
+error_page   404              /404.html;
+error_page   500 502 503 504  /50x.html;
 </example>
 </para>
 
 <para>
-Furthermore, it is possible to change the response code to another, for example:
+Furthermore, it is possible to change the response code to another
+using the “<literal>=code</literal>” syntax, for example:
 <example>
 error_page 404 =200 /empty.gif;
 </example>
@@ -609,8 +609,19 @@
 </para>
 
 <para>
-If there is no need to change URI during redirection it is possible to redirect
-error processing into a named location:
+It is also possible to use redirects for error processing:
+<example>
+error_page 403         http://example.com/forbidden.html;
+error_page 404 =301    http://example.com/notfound.html;
+</example>
+In this case, the response code 302 is returned to the client.
+It can only be changed to one of the redirect status
+codes (301, 302, 303 and 307).
+</para>
+
+<para>
+If there is no need to change URI during internal redirection it is
+possible to pass error processing into a named location:
 <example>
 location / {
     error_page 404 = @fallback;
@@ -622,6 +633,14 @@
 </example>
 </para>
 
+<para>
+<note>
+If the <literal>uri</literal> processing led to an error,
+the HTTP status code indicating last occurred problem
+will be returned.
+</note>
+</para>
+
 </directive>
 
 
--- a/xml/ru/docs/http/ngx_http_core_module.xml	Wed Sep 12 11:00:47 2012 +0000
+++ b/xml/ru/docs/http/ngx_http_core_module.xml	Thu Sep 13 08:02:40 2012 +0000
@@ -10,7 +10,7 @@
 <module name="Модуль ngx_http_core_module"
         link="/ru/docs/http/ngx_http_core_module.html"
         lang="ru"
-        rev="4">
+        rev="5">
 
 <section id="directives" name="Директивы">
 
@@ -568,20 +568,20 @@
 Директивы <literal>error_page</literal> наследуются с предыдущего уровня
 при условии, что на данном уровне не описаны свои директивы
 <literal>error_page</literal>.
-В значении URI можно использовать переменные.
+В значении <literal>uri</literal> можно использовать переменные.
 </para>
 
 <para>
 Пример:
 <example>
-error_page 404         /404.html;
-error_page 502 503 504 /50x.html;
-error_page 403         http://example.com/forbidden.html;
+error_page   404              /404.html;
+error_page   500 502 503 504  /50x.html;
 </example>
 </para>
 
 <para>
-Кроме того, можно поменять код ответа на другой, например:
+Кроме того, можно поменять код ответа на другой,
+используя синтаксис вида “<literal>=code</literal>”, например:
 <example>
 error_page 404 =200 /empty.gif;
 </example>
@@ -597,7 +597,19 @@
 </para>
 
 <para>
-Если при перенаправлении не нужно менять URI, то можно перенаправить
+Также существует возможность использовать перенаправления для обработки
+ошибок:
+<example>
+error_page 403         http://example.com/forbidden.html;
+error_page 404 =301    http://example.com/notfound.html;
+</example>
+В этому случае клиенту возвращается код ответа 302.
+Его можно изменить только на один из кодов статуса, относящихся к
+перенаправлениям (301, 302, 303 and 307).
+</para>
+
+<para>
+Если при внутреннем перенаправлении не нужно менять URI, то можно передать
 обработку ошибки в именованный location:
 <example>
 location / {
@@ -610,6 +622,14 @@
 </example>
 </para>
 
+<para>
+<note>
+В случае возникновения ошибки при обработке <literal>uri</literal>
+будет возвращен ответ с кодом HTTP статуса, отражающим последнюю
+возникшую проблему.
+</note>
+</para>
+
 </directive>