diff --git a/index.php b/index.php index 73739cb..86c8a78 100644 --- a/index.php +++ b/index.php @@ -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);