Added nullguard when req.socket.remoteAddress is null inside handleRequest()

This commit is contained in:
Dev 2024-04-15 00:06:53 +01:00
parent ad54e7ae98
commit 10b1b2b3aa

View File

@ -79,7 +79,9 @@ export class HttpServer
if (this.httpConfig.logRequests)
{
// TODO: Extend to include 192.168 / 10.10 ranges or check subnet
const isLocalRequest = req.socket.remoteAddress.startsWith("127.0.0");
const isLocalRequest = req.socket.remoteAddress?.startsWith("127.0.0");
if (typeof isLocalRequest !== "undefined")
{
if (isLocalRequest)
{
this.logger.info(this.localisationService.getText("client_request", req.url));
@ -92,6 +94,7 @@ export class HttpServer
}));
}
}
}
for (const listener of this.httpListeners)
{