Skip to content

Commit

Permalink
Fix: direct requests
Browse files Browse the repository at this point in the history
  • Loading branch information
xtrime-ru committed May 1, 2023
1 parent acfe597 commit ead300b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Server/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,12 @@ public static function getClientIp(Request $request): string
if ($realIpHeader) {
$remote = $request->getHeader($realIpHeader);
if (!$remote) {
throw new \InvalidArgumentException("Empty header: $realIpHeader");
GOTO DIRECT;
}
$tmp = explode(',', $remote);
$remote = trim(end($tmp));
} else {
DIRECT:
$remote = $request->getClient()->getRemoteAddress()->toString();
$hostArray = explode(':', $remote);
if (count($hostArray) >= 2) {
Expand Down

0 comments on commit ead300b

Please sign in to comment.