Handle forwarded requests not having port set in GetSmartApiUrl

This commit is contained in:
Shadowghost 2022-07-20 09:44:15 +02:00
parent 1c6b6f5d36
commit daf33143f6

View File

@ -1080,7 +1080,8 @@ namespace Emby.Server.Implementations
if (ConfigurationManager.GetNetworkConfiguration().EnablePublishedServerUriByRequest)
{
int? requestPort = request.Host.Port;
if ((requestPort == 80 && string.Equals(request.Scheme, "http", StringComparison.OrdinalIgnoreCase)) || (requestPort == 443 && string.Equals(request.Scheme, "https", StringComparison.OrdinalIgnoreCase)))
if (((requestPort == 80 || requestPort == null) && string.Equals(request.Scheme, "http", StringComparison.OrdinalIgnoreCase))
|| ((requestPort == 443 || requestPort == null) && string.Equals(request.Scheme, "https", StringComparison.OrdinalIgnoreCase)))
{
requestPort = -1;
}