aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
diff options
context:
space:
mode:
authorNyanmisaka <nst799610810@gmail.com>2021-08-13 15:01:06 +0800
committerGitHub <noreply@github.com>2021-08-13 15:01:06 +0800
commita84dc794c6960a8a6e1dc0660e15a030e0f51305 (patch)
tree9e1c33cab6cca6681811d0a2f6a51902c108bf77 /Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
parentd4f09c6c9b142081064c4008bc1e84fb17c81ad8 (diff)
parente33901b9f5f65eb8e48c018a30a37094ad874897 (diff)
Merge branch 'master' into tonemap-overlay
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;