aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-09-09 12:02:05 -0600
committercrobibero <cody@robibe.ro>2020-09-09 12:02:05 -0600
commit612e135c8c2b349e904bc555435bfc0977ed80d0 (patch)
tree8093307690ac8f1be6b08daa9042badad02b29f7 /Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
parenteab92a0b0124c2e89a8e11d4d6a8031f17834e36 (diff)
parentb76d4ba454c43cc6293b733f2bba363e34a9bf5e (diff)
Merge remote-tracking branch 'upstream/master' into api-stream-return
Diffstat (limited to 'Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs')
-rw-r--r--Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs6
1 files changed, 5 insertions, 1 deletions
diff --git a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
index ae3a3a1c5..9316737bd 100644
--- a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
+++ b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
@@ -44,7 +44,11 @@ namespace Jellyfin.Server.Middleware
var localPath = httpContext.Request.Path.ToString();
var baseUrlPrefix = serverConfigurationManager.Configuration.BaseUrl;
- if (!localPath.StartsWith(baseUrlPrefix, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(localPath, baseUrlPrefix + "/", StringComparison.OrdinalIgnoreCase)
+ || string.Equals(localPath, baseUrlPrefix, StringComparison.OrdinalIgnoreCase)
+ || string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase)
+ || string.IsNullOrEmpty(localPath)
+ || !localPath.StartsWith(baseUrlPrefix, StringComparison.OrdinalIgnoreCase))
{
// Always redirect back to the default path if the base prefix is invalid or missing
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);