mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-11 08:10:34 +02:00
Configure Kestrel listener to use configured IPs
This commit is contained in:
parent
3249fbb715
commit
cabb9aed31
|
@ -615,11 +615,34 @@ namespace Emby.Server.Implementations
|
||||||
var host = new WebHostBuilder()
|
var host = new WebHostBuilder()
|
||||||
.UseKestrel(options =>
|
.UseKestrel(options =>
|
||||||
{
|
{
|
||||||
options.ListenAnyIP(HttpPort);
|
var addresses = ServerConfigurationManager
|
||||||
|
.Configuration
|
||||||
if (EnableHttps && Certificate != null)
|
.LocalNetworkAddresses
|
||||||
|
.Select(NormalizeConfiguredLocalAddress)
|
||||||
|
.Where(i => i != null)
|
||||||
|
.ToList();
|
||||||
|
if (addresses.Any())
|
||||||
{
|
{
|
||||||
options.ListenAnyIP(HttpsPort, listenOptions => listenOptions.UseHttps(Certificate));
|
foreach (var address in addresses)
|
||||||
|
{
|
||||||
|
Logger.LogInformation("Kestrel listening on {ipaddr}", address);
|
||||||
|
options.Listen(address, HttpPort);
|
||||||
|
|
||||||
|
if (EnableHttps && Certificate != null)
|
||||||
|
{
|
||||||
|
options.Listen(address, HttpsPort, listenOptions => listenOptions.UseHttps(Certificate));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Logger.LogInformation("Kestrel listening on all interfaces");
|
||||||
|
options.ListenAnyIP(HttpPort);
|
||||||
|
|
||||||
|
if (EnableHttps && Certificate != null)
|
||||||
|
{
|
||||||
|
options.ListenAnyIP(HttpsPort, listenOptions => listenOptions.UseHttps(Certificate));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.UseContentRoot(contentRoot)
|
.UseContentRoot(contentRoot)
|
||||||
|
|
Loading…
Reference in a new issue