aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2021-05-27 06:31:00 -0600
committercrobibero <cody@robibe.ro>2021-05-27 06:31:00 -0600
commit9595aa258eaeab7cc5b73452bfe6a209512e77ce (patch)
treeedb81569800d02bb57d7896b0b59841ac7219daf /Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
parent01e8ff8ddf84ac033a00917664482f67572e0f9b (diff)
Simplify BaseUrlRedirectionMiddleware
Diffstat (limited to 'Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs')
-rw-r--r--Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs9
1 files changed, 3 insertions, 6 deletions
diff --git a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
index 3abf579e2..f09315de8 100644
--- a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
+++ b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
@@ -50,18 +50,15 @@ namespace Jellyfin.Server.Middleware
var startsWithBaseUrl = localPath.StartsWith(baseUrlPrefix, StringComparison.OrdinalIgnoreCase);
if (!startsWithBaseUrl
- && localPath.EndsWith("/health", StringComparison.OrdinalIgnoreCase))
+ && (localPath.Equals("/health", StringComparison.OrdinalIgnoreCase)
+ || localPath.Equals("/health/", StringComparison.OrdinalIgnoreCase)))
{
_logger.LogDebug("Redirecting /health check");
httpContext.Response.Redirect(baseUrlPrefix + "/health");
return;
}
- if (string.Equals(localPath, baseUrlPrefix + "/", StringComparison.OrdinalIgnoreCase)
- || string.Equals(localPath, baseUrlPrefix, StringComparison.OrdinalIgnoreCase)
- || string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase)
- || string.IsNullOrEmpty(localPath)
- || !startsWithBaseUrl)
+ if (!startsWithBaseUrl)
{
// Always redirect back to the default path if the base prefix is invalid or missing
_logger.LogDebug("Normalizing an URL at {LocalPath}", localPath);