aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
diff options
context:
space:
mode:
authorPatrick Barron <barronpm@gmail.com>2021-08-13 20:41:27 -0400
committerPatrick Barron <barronpm@gmail.com>2021-08-13 21:08:24 -0400
commit45f478f63e21667fa03bd2bd5156a7094a799f47 (patch)
tree29fbae969e392631eb478fc902f1a890cb959461 /Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
parent15baf04bd2bfc2850c4f516253f1925b40a02f5e (diff)
parent04571e93f80ce707372c7fe811150133d288b9b7 (diff)
Merge branch 'master' into authenticationdb-efcore
# Conflicts: # Jellyfin.Server.Implementations/Security/AuthorizationContext.cs # MediaBrowser.Controller/Library/IUserManager.cs # MediaBrowser.Controller/Security/IAuthenticationRepository.cs # MediaBrowser.Controller/Session/ISessionManager.cs
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;