Quantcast
Channel: Nginx Forum - Nginx Mailing List - Russian
Viewing all articles
Browse latest Browse all 3102

Re: auth request и conn limit (no replies)

$
0
0
Hello!

On Fri, Apr 01, 2016 at 03:02:01AM -0400, Vans_ wrote:

> Добрый день всем!
>
> Можно ли заставить работать одновременно conn_limit и auth_request
> одновременно?
>
> Желаемая схема такая:
> location /data0002 {
> auth_request /authcheck;
> auth_request_set $error_code $upstream_http_x_error_code;
> auth_request_set $token $upstream_http_x_token;
> limit_conn connections 1;
> limit_conn_status 429;
> error_page 403 =200 /forbiden;
> error_page 429 =200 /to_many_connections;
> proxy_intercept_errors on;
> proxy_pass_request_body off;
> proxy_set_header Content-Length "";
> proxy_pass http://127.0.0.1:8000/data;
> error_page 500 501 502 503 504 404 403 =200 /no_data;
> }
>
> Но смысл в том, что похоже conn_limit отрабатывает до auth_check и $token
> устанавливается после того, как отработает conn_limit.
> Причем, задать $token статически, то conn_limit отрабатывает, но это не
> интересно.....

Так работать не будет, т.к. limit_conn работает до авторизации, а
$token доступен только после.

Извлекайте $token из запроса до авторизации (а в процессе
авторизации, соответственно, подтверждайте право его
использования). Тогда всё будет работать.

--
Maxim Dounin
http://nginx.org/

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Viewing all articles
Browse latest Browse all 3102

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>