Merge pull request #6162 from crobibero/no-base-redirect

Redirect to default if root is requested
This commit is contained in:
Claus Vium 2021-06-07 23:06:33 +02:00 committed by GitHub
commit 19a1889906
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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);
}