The Free Software Media System - Server Backend & API
Configure Kestrel listener to use configured IPs
Joshua Bonifacecabb9aed3142
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.csindex 1d0293a5f3..5719c5e46f 100644--- a/Emby.Server.Implementations/ApplicationHost.cs+++ b/Emby.Server.Implementations/ApplicationHost.cs@@ -615,11 +615,34 @@ namespace Emby.Server.Implementationsvar host = new WebHostBuilder().UseKestrel(options =>{- options.ListenAnyIP(HttpPort);+ var addresses = ServerConfigurationManager+ .Configuration+ .LocalNetworkAddresses+ .Select(NormalizeConfiguredLocalAddress)+ .Where(i => i != null)+ .ToList();+ if (addresses.Any())+ {+ foreach (var address in addresses)+ {+ Logger.LogInformation("Kestrel listening on {ipaddr}", address);+ options.Listen(address, HttpPort);- if (EnableHttps && Certificate != null)+ if (EnableHttps && Certificate != null)+ {+ options.Listen(address, HttpsPort, listenOptions => listenOptions.UseHttps(Certificate));+ }+ }+ }+ else{- options.ListenAnyIP(HttpsPort, listenOptions => listenOptions.UseHttps(Certificate));+ Logger.LogInformation("Kestrel listening on all interfaces");+ options.ListenAnyIP(HttpPort);++ if (EnableHttps && Certificate != null)+ {+ options.ListenAnyIP(HttpsPort, listenOptions => listenOptions.UseHttps(Certificate));+ }}}).UseContentRoot(contentRoot)