fix: get ip in cli mode
This commit is contained in:
parent
8b5aa07b1f
commit
33ccd5898a
@ -29,7 +29,12 @@ $loop->run();
|
||||
|
||||
|
||||
function handler(Psr\Http\Message\ServerRequestInterface $req) {
|
||||
$ip = $req->getHeader('REMOTE_ADDR')[0];
|
||||
$ip = $req->getHeader('REMOTE_ADDR');
|
||||
if (!$ip) {
|
||||
$ip = $req->getServerParams()['REMOTE_ADDR'];
|
||||
} else {
|
||||
$ip = $ip[0];
|
||||
}
|
||||
$url = $req->getUri()->getPath();
|
||||
// strip start /
|
||||
$url = substr($url, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user