Новости | FAQ | Авторы | Документация | В действии | Библиотека |
Инструменты | Полезные ссылки | Хостинги | Скачать | Примеры | Форум |
AK666 19.11.2013 04:51 / 19.11.2013 04:55
не получается передать "обратные" заголовки из скрипта серверу... location /w { auth_request /auth; auth_request_set $test_uin $upstream_http_x_auth_uin; add_header Test-Uin $test_uin; auth_request_set $test_name $upstream_http_x_auth_name; add_header Test-Name $test_name; try_files $uri $uri/ / ; index index.p3h index.html; } location = /auth { internal; root /www/site-auth; gzip off; fastcgi_pass unix:/var/run/fcgiwrap.socket; fastcgi_param REALM "Test Auth"; fastcgi_param SCRIPT_NAME /www/site-auth/auth.p3h; fastcgi_param SCRIPT_FILENAME /www/parser/current/parser3.cgi; fastcgi_param PATH_INFO /auth.p3h; fastcgi_param PATH_TRANSLATED /www/site-auth/auth.p3h; fastcgi_param CGI_PARSER_LOG /var/log/nginx/parser_auth.log; fastcgi_param Content-Length ""; fastcgi_param CONTENT_LENGTH ""; include /etc/nginx/fastcgi_params; }auth.p3h
... @main[] ^rem{ get $login $pwd from $env:HTTP_AUTHORIZATION } $http_auth[$env:HTTP_AUTHORIZATION] $m[^http_auth.match[Basic ([a-zA-Z0-9=]+)]] $http_auth[^string:base64[$m.1]] $auth[^http_auth.match[(\w+):(\S+)]] $UIN[$auth.1] $PWD[$auth.2] ... ... ^db{$userData[^hash::sql{SELECT UIN, passwd, RealName FROM Users WHERE UIN = _utf8'$UIN'}[$.limit(1)]]} ... ^rem{ password check crypt+apr1 } ^if(^math:crypt[$PWD;$userData.$UIN.passwd] ne $userData.$UIN.passwd){^throw[auth.401]} ... $response:x_auth_UIN[$UIN] $response:x_auth_Name[$userData.$UIN.Name] #end mainвсю голову уже сломал :(