# HG changeset patch # User Vladimir Homutov # Date 1377177822 -14400 # Node ID 6316a7579448a18ad0a59a27f2781fe0c6665b6b # Parent 051de14a6e794fdd3e3621a66ecc0bece801b6fa Documented the "ngx_http_auth_request" module. diff -r 051de14a6e79 -r 6316a7579448 xml/en/GNUmakefile --- a/xml/en/GNUmakefile Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/en/GNUmakefile Thu Aug 22 17:23:42 2013 +0400 @@ -35,6 +35,7 @@ http/ngx_http_access_module \ http/ngx_http_addition_module \ http/ngx_http_auth_basic_module \ + http/ngx_http_auth_request_module \ http/ngx_http_autoindex_module \ http/ngx_http_browser_module \ http/ngx_http_charset_module \ diff -r 051de14a6e79 -r 6316a7579448 xml/en/docs/http/ngx_http_access_module.xml --- a/xml/en/docs/http/ngx_http_access_module.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/en/docs/http/ngx_http_access_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -10,7 +10,7 @@ + rev="3">
@@ -21,7 +21,8 @@ Access can also be limited by -password. +password or by the +result of subrequest. Simultaneous limitation of access by address and by password is controlled by the directive. diff -r 051de14a6e79 -r 6316a7579448 xml/en/docs/http/ngx_http_auth_basic_module.xml --- a/xml/en/docs/http/ngx_http_auth_basic_module.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/en/docs/http/ngx_http_auth_basic_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -10,7 +10,7 @@ + rev="6">
@@ -22,7 +22,8 @@ Access can also be limited by -address. +address or by the +result of subrequest. Simultaneous limitation of access by address and by password is controlled by the directive. diff -r 051de14a6e79 -r 6316a7579448 xml/en/docs/http/ngx_http_auth_request_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/en/docs/http/ngx_http_auth_request_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -0,0 +1,113 @@ + + + + + + + + +
+ + +The ngx_http_auth_request_module module (1.5.4+) implements +client authorization based on the result of a subrequest. +If the subrequest returns a 2xx response code, the access is allowed. +If it returns 401 or 403, +the access is denied with the corresponding error code. +Any other response code returned by the subrequest is considered an error. + + + +For the 401 error, the client also receives the +
WWW-Authenticate
header from the subrequest response. +
+ + +This module is not built by default, it should be enabled with the +--with-http_auth_request_module +configuration parameter. + + + +The module may be combined with +other access modules, such as +ngx_http_access_module and +ngx_http_auth_basic_module, +via the directive. + +Currently, it is not possible to use + and + +( and +) +for requests initiated by the +ngx_http_auth_request_module module. + + + +
+ + +
+ + + +location /private/ { + auth_request /auth; + ... +} + +location = /auth { + proxy_pass ... + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; +} + + + +
+ + +
+ + +uri | off +off +http +server +location + + +Enables authorization based on the result of a subrequest and sets +the URI to which the subrequest will be sent. + + + + + + +variable value + +http +server +location + + +Sets the request variable to the given +value after the authorization request completes. +The value may contain variables from the authorization request, +such as $upstream_http_*. + + + + +
+ +
diff -r 051de14a6e79 -r 6316a7579448 xml/en/docs/http/ngx_http_core_module.xml --- a/xml/en/docs/http/ngx_http_core_module.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/en/docs/http/ngx_http_core_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -10,7 +10,7 @@ + rev="23">
@@ -2037,10 +2037,11 @@ location -Allows access if both (all) or at least one +Allows access if all (all) or at least one (any) of the -ngx_http_access_module -or ngx_http_auth_basic_module +ngx_http_access_module, +ngx_http_auth_basic_module or +ngx_http_auth_request_module modules allow access. diff -r 051de14a6e79 -r 6316a7579448 xml/en/docs/index.xml --- a/xml/en/docs/index.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/en/docs/index.xml Thu Aug 22 17:23:42 2013 +0400 @@ -171,6 +171,11 @@ + +ngx_http_auth_request_module + + + ngx_http_autoindex_module diff -r 051de14a6e79 -r 6316a7579448 xml/en/index.xml --- a/xml/en/index.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/en/index.xml Thu Aug 22 17:23:42 2013 +0400 @@ -8,7 +8,7 @@
+ rev="12">
@@ -151,9 +151,11 @@ Access control based on -client IP address -and HTTP -Basic authentication; +client IP address, +by password (HTTP +Basic authentication) and by the +result of +subrequest; diff -r 051de14a6e79 -r 6316a7579448 xml/ru/GNUmakefile --- a/xml/ru/GNUmakefile Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/ru/GNUmakefile Thu Aug 22 17:23:42 2013 +0400 @@ -26,6 +26,7 @@ http/ngx_http_access_module \ http/ngx_http_addition_module \ http/ngx_http_auth_basic_module \ + http/ngx_http_auth_request_module \ http/ngx_http_autoindex_module \ http/ngx_http_browser_module \ http/ngx_http_charset_module \ diff -r 051de14a6e79 -r 6316a7579448 xml/ru/docs/http/ngx_http_access_module.xml --- a/xml/ru/docs/http/ngx_http_access_module.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/ru/docs/http/ngx_http_access_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -10,7 +10,7 @@ + rev="3">
@@ -21,7 +21,8 @@ Ограничить доступ можно также по -паролю. +паролю или по +результату подзапроса. Одновременное ограничение доступа по адресу и паролю управляется директивой . diff -r 051de14a6e79 -r 6316a7579448 xml/ru/docs/http/ngx_http_auth_basic_module.xml --- a/xml/ru/docs/http/ngx_http_auth_basic_module.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/ru/docs/http/ngx_http_auth_basic_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -10,7 +10,7 @@ + rev="6">
@@ -22,7 +22,8 @@ Ограничить доступ можно также по -адресу. +адресу или по +результату подзапроса. Одновременное ограничение доступа по адресу и паролю управляется директивой . diff -r 051de14a6e79 -r 6316a7579448 xml/ru/docs/http/ngx_http_auth_request_module.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/xml/ru/docs/http/ngx_http_auth_request_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -0,0 +1,112 @@ + + + + + + + + +
+ + +Модуль ngx_http_auth_request_module (1.5.4+) предоставляет +возможность авторизации клиента, основанной на результате подзапроса. +Если подзапрос возвращает код ответа 2xx, доступ разрешается. +Если 401 или 403 — доступ запрещается с соответствующим кодом ошибки. +Любой другой код ответа, возвращаемый подзапросом, считается ошибкой. + + + +При ошибке 401 клиенту также передаётся заголовок +
WWW-Authenticate
из ответа подзапроса. +
+ + +По умолчанию этот модуль не собирается, его сборку необходимо +разрешить с помощью конфигурационного параметра +--with-http_auth_request_module. + + + +Модуль может быть +скомбинирован с другими модулями доступа, такими как +ngx_http_access_module и +ngx_http_auth_basic_module, +с помощью директивы . + +В данный момент директивы + и + +( и +) +невозможно использовать для обработки запросов, исходящих от модуля +ngx_http_auth_request_module. + + + +
+ + +
+ + + +location /private/ { + auth_request /auth; + ... +} + +location = /auth { + proxy_pass ... + proxy_pass_request_body off; + proxy_set_header Content-Length ""; + proxy_set_header X-Original-URI $request_uri; +} + + + +
+ + +
+ + +uri | off +off +http +server +location + + +Включает авторизацию, основанную на результате выполнения подзапроса, +и задаёт URI, на который будет отправлен подзапрос. + + + + + + +переменная значение + +http +server +location + + +Устанавливает переменную в запросе в заданное +значение после завершения запроса авторизации. +Значение может содержать переменные из запроса авторизации, +например, $upstream_http_*. + + + + +
+ +
diff -r 051de14a6e79 -r 6316a7579448 xml/ru/docs/http/ngx_http_core_module.xml --- a/xml/ru/docs/http/ngx_http_core_module.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/ru/docs/http/ngx_http_core_module.xml Thu Aug 22 17:23:42 2013 +0400 @@ -10,7 +10,7 @@ + rev="23">
@@ -2033,10 +2033,11 @@ location -Разрешает доступ, если оба (all) +Разрешает доступ, если все (all) или хотя бы один (any) из модулей -ngx_http_access_module -и ngx_http_auth_basic_module +ngx_http_access_module, +ngx_http_auth_basic_module или +ngx_http_auth_request_module разрешают доступ. diff -r 051de14a6e79 -r 6316a7579448 xml/ru/docs/index.xml --- a/xml/ru/docs/index.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/ru/docs/index.xml Thu Aug 22 17:23:42 2013 +0400 @@ -159,6 +159,11 @@ + +ngx_http_auth_request_module + + + ngx_http_autoindex_module diff -r 051de14a6e79 -r 6316a7579448 xml/ru/index.xml --- a/xml/ru/index.xml Fri Aug 16 10:20:23 2013 +0000 +++ b/xml/ru/index.xml Thu Aug 22 17:23:42 2013 +0400 @@ -8,7 +8,7 @@
+ rev="12">
@@ -152,9 +152,11 @@ Ограничение доступа в зависимости от -адреса клиента -и по паролю -(HTTP Basic аутентификация); +адреса клиента, +по паролю +(HTTP Basic аутентификация) и по +результату +подзапроса;