feat: log real ip

This commit is contained in:
tlanyan
2021-01-12 17:48:27 +08:00
parent 232c3907a7
commit 8b5aa07b1f
2 changed files with 5 additions and 1 deletions
+2 -1
View File
@@ -29,10 +29,11 @@ $loop->run();
function handler(Psr\Http\Message\ServerRequestInterface $req) {
$ip = $req->getHeader('REMOTE_ADDR')[0];
$url = $req->getUri()->getPath();
// strip start /
$url = substr($url, 1);
echo "request url: ", $url, PHP_EOL;
echo "IP:", $ip, ", request url: ", $url, PHP_EOL;
if (substr($url, 0, 4) !== 'http') {
return serveStaticFiles($url);