# HG changeset patch # User Vladimir Homutov # Date 1347523360 0 # Node ID 9888364847b7d98c80d833cea12bb2a98b14c233 # Parent 90c27a37f4edf4ab985659052896894e36908f03 Documented status codes in the error_page directive. diff -r 90c27a37f4ed -r 9888364847b7 xml/en/docs/http/ngx_http_core_module.xml --- 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 @@ + rev="5">
@@ -580,20 +580,20 @@ error_page directives on the current level. -A URI value can contain variables. +A uri value can contain variables. 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; -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 “=code” syntax, for example: error_page 404 =200 /empty.gif; @@ -609,8 +609,19 @@ -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: + +error_page 403 http://example.com/forbidden.html; +error_page 404 =301 http://example.com/notfound.html; + +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). + + + +If there is no need to change URI during internal redirection it is +possible to pass error processing into a named location: location / { error_page 404 = @fallback; @@ -622,6 +633,14 @@ + + +If the uri processing led to an error, +the HTTP status code indicating last occurred problem +will be returned. + + + diff -r 90c27a37f4ed -r 9888364847b7 xml/ru/docs/http/ngx_http_core_module.xml --- 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 @@ + rev="5">
@@ -568,20 +568,20 @@ Директивы error_page наследуются с предыдущего уровня при условии, что на данном уровне не описаны свои директивы error_page. -В значении URI можно использовать переменные. +В значении uri можно использовать переменные. Пример: -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; -Кроме того, можно поменять код ответа на другой, например: +Кроме того, можно поменять код ответа на другой, +используя синтаксис вида “=code”, например: error_page 404 =200 /empty.gif; @@ -597,7 +597,19 @@ -Если при перенаправлении не нужно менять URI, то можно перенаправить +Также существует возможность использовать перенаправления для обработки +ошибок: + +error_page 403 http://example.com/forbidden.html; +error_page 404 =301 http://example.com/notfound.html; + +В этому случае клиенту возвращается код ответа 302. +Его можно изменить только на один из кодов статуса, относящихся к +перенаправлениям (301, 302, 303 and 307). + + + +Если при внутреннем перенаправлении не нужно менять URI, то можно передать обработку ошибки в именованный location: location / { @@ -610,6 +622,14 @@ + + +В случае возникновения ошибки при обработке uri +будет возвращен ответ с кодом HTTP статуса, отражающим последнюю +возникшую проблему. + + +