mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-06-04 22:24:35 -04:00
fixes #1427 - [Feature Request]: Require Encryption
This commit is contained in:
parent
134e74414d
commit
878abbddda
@ -1931,13 +1931,13 @@ namespace Emby.Server.Implementations
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return SupportsHttps && ServerConfigurationManager.Configuration.EnableHttps;
|
return SupportsHttps && (ServerConfigurationManager.Configuration.EnableHttps || ServerConfigurationManager.Configuration.RequireHttps);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SupportsHttps
|
public bool SupportsHttps
|
||||||
{
|
{
|
||||||
get { return Certificate != null; }
|
get { return Certificate != null || ServerConfigurationManager.Configuration.IsBehindProxy; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<string> GetLocalApiUrl()
|
public async Task<string> GetLocalApiUrl()
|
||||||
|
@ -48,7 +48,7 @@ namespace Emby.Server.Implementations.EntryPoints
|
|||||||
values.Add(config.PublicPort.ToString(CultureInfo.InvariantCulture));
|
values.Add(config.PublicPort.ToString(CultureInfo.InvariantCulture));
|
||||||
values.Add(_appHost.HttpPort.ToString(CultureInfo.InvariantCulture));
|
values.Add(_appHost.HttpPort.ToString(CultureInfo.InvariantCulture));
|
||||||
values.Add(_appHost.HttpsPort.ToString(CultureInfo.InvariantCulture));
|
values.Add(_appHost.HttpsPort.ToString(CultureInfo.InvariantCulture));
|
||||||
values.Add(config.EnableHttps.ToString());
|
values.Add((config.EnableHttps || config.RequireHttps).ToString());
|
||||||
values.Add(_appHost.EnableHttps.ToString());
|
values.Add(_appHost.EnableHttps.ToString());
|
||||||
|
|
||||||
return string.Join("|", values.ToArray(values.Count));
|
return string.Join("|", values.ToArray(values.Count));
|
||||||
|
@ -423,6 +423,19 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool ValidateSsl(string remoteIp)
|
||||||
|
{
|
||||||
|
if (_config.Configuration.RequireHttps && _appHost.EnableHttps)
|
||||||
|
{
|
||||||
|
if (!_networkManager.IsInLocalNetwork(remoteIp))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Overridable method that can be used to implement a custom hnandler
|
/// Overridable method that can be used to implement a custom hnandler
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -453,6 +466,12 @@ namespace Emby.Server.Implementations.HttpServer
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!ValidateSsl(httpReq.RemoteIp))
|
||||||
|
{
|
||||||
|
RedirectToUrl(httpRes, urlString.Replace("http://", "https://", StringComparison.OrdinalIgnoreCase));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
|
if (string.Equals(httpReq.Verb, "OPTIONS", StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
httpRes.StatusCode = 200;
|
httpRes.StatusCode = 200;
|
||||||
|
@ -181,6 +181,8 @@ namespace MediaBrowser.Model.Configuration
|
|||||||
public string[] CodecsUsed { get; set; }
|
public string[] CodecsUsed { get; set; }
|
||||||
public bool EnableChannelView { get; set; }
|
public bool EnableChannelView { get; set; }
|
||||||
public bool EnableExternalContentInSuggestions { get; set; }
|
public bool EnableExternalContentInSuggestions { get; set; }
|
||||||
|
public bool RequireHttps { get; set; }
|
||||||
|
public bool IsBehindProxy { get; set; }
|
||||||
|
|
||||||
public int ImageExtractionTimeoutMs { get; set; }
|
public int ImageExtractionTimeoutMs { get; set; }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user