aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Boniface <joshua@boniface.me>2019-09-29 00:07:44 -0400
committerJoshua Boniface <joshua@boniface.me>2019-09-29 00:37:48 -0400
commitcabb9aed3142773ab3bec4627b2aec3dc470f02e (patch)
treecaee42d8389831c69f19307f4c134000a9348ae0
parent3249fbb7159aaaa6ecb54398e81800b0c3a5e77f (diff)
Configure Kestrel listener to use configured IPs
-rw-r--r--Emby.Server.Implementations/ApplicationHost.cs29
1 files changed, 26 insertions, 3 deletions
diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs
index 1d0293a5f..5719c5e46 100644
--- a/Emby.Server.Implementations/ApplicationHost.cs
+++ b/Emby.Server.Implementations/ApplicationHost.cs
@@ -615,11 +615,34 @@ namespace Emby.Server.Implementations
var 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)