aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs
diff options
context:
space:
mode:
authorJim Cartlidge <jimcartlidge@yahoo.co.uk>2020-09-15 18:05:53 +0100
committerJim Cartlidge <jimcartlidge@yahoo.co.uk>2020-09-15 18:05:53 +0100
commit0bc37c981d63a4d8168d622c452d6fac1b061e07 (patch)
tree03b0fdd7c3b366c858e8d21fb57629ddc9f557c1 /Jellyfin.Server/Middleware/IpBasedAccessValidationMiddleware.cs
parente6a3518220f159325cdf941fbfbbcd8ba871c28c (diff)
parent96c3c4af4237c1fd1955fe5840904015ae592bef (diff)
Merge branch 'NetworkPR2' of https://github.com/BaronGreenback/jellyfin into NetworkPR2
Diffstat (limited to 'Jellyfin.Server/Middleware/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)
{