aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
diff options
context:
space:
mode:
authorClaus Vium <cvium@users.noreply.github.com>2021-08-18 18:25:48 +0200
committerGitHub <noreply@github.com>2021-08-18 18:25:48 +0200
commit663c79cba8be58196ec210bd792388b9cf86830c (patch)
tree46fc02de09ed5419c118ecb66a25e13ae884befd /Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
parent398ca85944c21609156892dd8c5560126336f11b (diff)
parente5cbafdb6b47377052e0d638908ef96e30a997d6 (diff)
Merge branch 'master' into baseitemkind-fixes
Diffstat (limited to 'Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs')
-rw-r--r--Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs7
1 files changed, 5 insertions, 2 deletions
diff --git a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
index 2eef223e5..3e5982eed 100644
--- a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
+++ b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
@@ -58,9 +58,12 @@ namespace Jellyfin.Server.Middleware
return;
}
- if (!startsWithBaseUrl)
+ if (!startsWithBaseUrl
+ || localPath.Length == baseUrlPrefix.Length
+ // Local path is /baseUrl/
+ || (localPath.Length == baseUrlPrefix.Length + 1 && localPath[^1] == '/'))
{
- // Always redirect back to the default path if the base prefix is invalid or missing
+ // Always redirect back to the default path if the base prefix is invalid, missing, or is the full path.
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);
httpContext.Response.Redirect(baseUrlPrefix + "/" + _configuration[ConfigurationExtensions.DefaultRedirectKey]);
return;