Fixed ip for proxy

This commit is contained in:
Alex Solomaha
2017-06-19 21:22:19 +03:00
parent d795269455
commit 531e5b3f97

View File

@@ -299,8 +299,10 @@ class CoreServer implements MessageComponentInterface
throw new NotFoundHttpException("Board with given ID does not exists");
}
if (!$board->remote_connection and !IPHelper::isLocal($conn->remoteAddress)) {
$this->log("Remote connection blocked for board [$boardID]; IP: {$conn->remoteAddress}");
$ip = $conn->WebSocket->request->getHeader('X-Forwarded-For') != null ? $conn->WebSocket->request->getHeader('X-Forwarded-For') : $conn->remoteAddress;
if (!$board->remote_connection and !IPHelper::isLocal($ip)) {
$this->log("Remote connection blocked for board [$boardID]; IP: {$ip}");
throw new ForbiddenHttpException("Remote connection is not allowed for this Board");
}