Merge pull request #10822 from crobibero/service-unavailable

Respond with Service Unavailable if not in correct network
This commit is contained in:
Bond-009 2024-01-07 13:39:26 +01:00 committed by GitHub
commit 71ae715b3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,8 @@ public class IPBasedAccessValidationMiddleware
if (!networkManager.HasRemoteAccess(remoteIP))
{
// No access from network, respond with 503 instead of 200.
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
return;
}

View File

@ -1,3 +1,4 @@
using System.Net;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
@ -40,6 +41,8 @@ public class LanFilteringMiddleware
var host = httpContext.GetNormalizedRemoteIP();
if (!networkManager.IsInLocalNetwork(host))
{
// No access from network, respond with 503 instead of 200.
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
return;
}