diff --git a/src/Jackett/Models/Config/ServerConfig.cs b/src/Jackett/Models/Config/ServerConfig.cs index 95486b0dd..b6c512ca1 100644 --- a/src/Jackett/Models/Config/ServerConfig.cs +++ b/src/Jackett/Models/Config/ServerConfig.cs @@ -18,14 +18,23 @@ namespace Jackett.Models.Config public bool AllowExternal { get; set; } public string APIKey { get; set; } - public string GetListenAddress(bool? external = null) + public string[] GetListenAddresses(bool? external = null) { - if (external == null) { external = AllowExternal; } - return "http://" + (external.Value ? "*" : "127.0.0.1") + ":" + Port + "/"; + if (external.Value) + { + return new string[] { "http://*:" + Port + "/" }; + } + else + { + return new string[] { + "http://127.0.0.1:" + Port + "/", + "http://localhost:" + Port + "/", + }; + } } public string GenerateApi() diff --git a/src/Jackett/Services/ServerService.cs b/src/Jackett/Services/ServerService.cs index 22f7c6565..aec4570e4 100644 --- a/src/Jackett/Services/ServerService.cs +++ b/src/Jackett/Services/ServerService.cs @@ -103,22 +103,24 @@ namespace Jackett.Services // Load indexers indexerService.InitIndexers(); - + // Start the server - logger.Debug("Starting web server at " + config.GetListenAddress()); - _server = WebApp.Start(url: config.GetListenAddress()); + logger.Debug("Starting web server at " + config.GetListenAddresses()[0]); + var startOptions = new StartOptions(); + config.GetListenAddresses().ToList().ForEach(u => startOptions.Urls.Add(u)); + _server = WebApp.Start(startOptions); logger.Debug("Web server started"); } public void ReserveUrls(bool doInstall = true) { logger.Debug("Unreserving Urls"); - RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(false))); - RunNetSh(string.Format("http delete urlacl {0}", config.GetListenAddress(true))); + config.GetListenAddresses(false).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u))); + config.GetListenAddresses(true).ToList().ForEach(u => RunNetSh(string.Format("http delete urlacl {0}", u))); if (doInstall) { logger.Debug("Reserving Urls"); - RunNetSh(string.Format("http add urlacl {0} sddl=D:(A;;GX;;;S-1-1-0)", config.GetListenAddress())); + config.GetListenAddresses(true).ToList().ForEach(u => RunNetSh(string.Format("http add urlacl {0} sddl=D:(A;;GX;;;S-1-1-0)", u))); logger.Debug("Urls reserved"); } }