aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaronGreenback <jimcartlidge@yahoo.co.uk>2020-09-15 13:48:40 +0100
committerGitHub <noreply@github.com>2020-09-15 13:48:40 +0100
commit96c3c4af4237c1fd1955fe5840904015ae592bef (patch)
treef9e9d76635efed17e58e0218dac494b8f4ea7236
parent40464a6fddf3b522c57a72e16bd036fbe8ac4580 (diff)
Update IpBasedAccessValidationMiddleware.cs
-rw-r--r--Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs b/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs
index 7f6b6bcce..0713d97d6 100644
--- a/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs
+++ b/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs
@@ -1,4 +1,4 @@
-using System.Linq;
+using System.Net;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
@@ -33,14 +33,14 @@ namespace Jellyfin.Server.Middleware
/// <returns>The async task.</returns>
public async Task Invoke(HttpContext httpContext, INetworkManager networkManager, IServerConfigurationManager serverConfigurationManager)
{
- if (httpContext.Connection.RemoteIpAddress == null)
+ if (httpContext.IsLocal())
{
// Running locally.
await _next(httpContext).ConfigureAwait(false);
return;
}
- var remoteIp = httpContext.Connection.RemoteIpAddress;
+ var remoteIp = httpContext.Connection.RemoteIpAddress ?? IPAddress.Loopback;
if (serverConfigurationManager.Configuration.EnableRemoteAccess)
{