From dfc776e451bcd504d35d4619ff74be2fde0492e4 Mon Sep 17 00:00:00 2001 From: crobibero Date: Mon, 7 Jun 2021 07:47:49 -0600 Subject: [PATCH] Redirect to default if root is requested --- .../Middleware/BaseUrlRedirectionMiddleware.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs index f09315de84..2eef223e52 100644 --- a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs +++ b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs @@ -66,6 +66,14 @@ namespace Jellyfin.Server.Middleware return; } } + else if (string.IsNullOrEmpty(localPath) + || localPath.Equals("/", StringComparison.Ordinal)) + { + // Always redirect back to the default path if root is requested. + _logger.LogDebug("Normalizing an URL at {LocalPath}", localPath); + httpContext.Response.Redirect("/" + _configuration[ConfigurationExtensions.DefaultRedirectKey]); + return; + } await _next(httpContext).ConfigureAwait(false); }