diff options
| author | Bond-009 <bond.009@outlook.com> | 2020-04-05 15:09:27 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-04-05 15:09:27 +0200 |
| commit | 29539174a3de47c151cc7c7fd192100e6fbe48d7 (patch) | |
| tree | 9649a7161519f137d43424862d2839a7f0748319 /Jellyfin.Server/Program.cs | |
| parent | a05cdf0b05689fd57f89599af7149b9d941aaed7 (diff) | |
| parent | bc91445b5dab26713c7b66629518504d5e4b5168 (diff) | |
Merge pull request #2636 from mark-monteiro/development-https
Use ASP.NET Core HTTPS Development Certificate
Diffstat (limited to 'Jellyfin.Server/Program.cs')
| -rw-r--r-- | Jellyfin.Server/Program.cs | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Jellyfin.Server/Program.cs b/Jellyfin.Server/Program.cs index 4abdd59aa..e55b0d4ed 100644 --- a/Jellyfin.Server/Program.cs +++ b/Jellyfin.Server/Program.cs @@ -25,6 +25,7 @@ using Microsoft.AspNetCore.Server.Kestrel.Core; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Serilog; @@ -259,7 +260,7 @@ namespace Jellyfin.Server IApplicationPaths appPaths) { return new WebHostBuilder() - .UseKestrel(options => + .UseKestrel((builderContext, options) => { var addresses = appHost.ServerConfigurationManager .Configuration @@ -282,6 +283,14 @@ namespace Jellyfin.Server listenOptions.Protocols = HttpProtocols.Http1AndHttp2; }); } + else if (builderContext.HostingEnvironment.IsDevelopment()) + { + options.Listen(address, appHost.HttpsPort, listenOptions => + { + listenOptions.UseHttps(); + listenOptions.Protocols = HttpProtocols.Http1AndHttp2; + }); + } } } else @@ -297,6 +306,14 @@ namespace Jellyfin.Server listenOptions.Protocols = HttpProtocols.Http1AndHttp2; }); } + else if (builderContext.HostingEnvironment.IsDevelopment()) + { + options.ListenAnyIP(appHost.HttpsPort, listenOptions => + { + listenOptions.UseHttps(); + listenOptions.Protocols = HttpProtocols.Http1AndHttp2; + }); + } } }) .ConfigureAppConfiguration(config => config.ConfigureAppConfiguration(commandLineOpts, appPaths, startupConfig)) |
