I've solved this with
location ~ '^/el/(?<tk>.+)/(?<tail>php/\d/[\w+/\.-=_]+)?$' {
set $auth_request_uri "http://127.0.0.1:10101/auth/$tk";
auth_request /auth;
autoindex on;
alias /var/ftp/pub/centos/php/$tail;
}
location /auth {
internal;
proxy_pass $auth_request_uri;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
location ~ '^/el/(?<tk>.+)/(?<tail>php/\d/[\w+/\.-=_]+)?$' {
set $auth_request_uri "http://127.0.0.1:10101/auth/$tk";
auth_request /auth;
autoindex on;
alias /var/ftp/pub/centos/php/$tail;
}
location /auth {
internal;
proxy_pass $auth_request_uri;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}