Merge pull request #10822 from crobibero/service-unavailable
Respond with Service Unavailable if not in correct network
This commit is contained in:
commit
71ae715b3b
|
@ -41,6 +41,8 @@ public class IPBasedAccessValidationMiddleware
|
||||||
|
|
||||||
if (!networkManager.HasRemoteAccess(remoteIP))
|
if (!networkManager.HasRemoteAccess(remoteIP))
|
||||||
{
|
{
|
||||||
|
// No access from network, respond with 503 instead of 200.
|
||||||
|
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
using System.Net;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using MediaBrowser.Common.Extensions;
|
using MediaBrowser.Common.Extensions;
|
||||||
using MediaBrowser.Common.Net;
|
using MediaBrowser.Common.Net;
|
||||||
|
@ -40,6 +41,8 @@ public class LanFilteringMiddleware
|
||||||
var host = httpContext.GetNormalizedRemoteIP();
|
var host = httpContext.GetNormalizedRemoteIP();
|
||||||
if (!networkManager.IsInLocalNetwork(host))
|
if (!networkManager.IsInLocalNetwork(host))
|
||||||
{
|
{
|
||||||
|
// No access from network, respond with 503 instead of 200.
|
||||||
|
httpContext.Response.StatusCode = StatusCodes.Status503ServiceUnavailable;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user