а, кажется разобрался. так работает:
location = /test.php {
auth_request /is_proxy.php;
fastcgi_pass fcgi_pool;
}
location = /is_proxy.php {
fastcgi_pass_request_body off;
fastcgi_intercept_errors off;
fastcgi_pass fcgi_pool;
}
cat is_proxy.php
<?php
if (!empty($_SERVER['REMOTE_ADDR'])) {
$ip=$_SERVER['REMOTE_ADDR'];
$url="http://someservice.com/check.php?ip=$ip";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL,$url);
$result=curl_exec($ch);
curl_close($ch);
echo($ip);
if ($result === 'Y') {
http_response_code(403);
} else {
http_response_code(200);
}
} else {
//failsafe
http_response_code(200);
}
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru