diff options
| author | crobibero <cody@robibe.ro> | 2021-06-07 07:47:49 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2021-06-07 07:47:49 -0600 |
| commit | dfc776e451bcd504d35d4619ff74be2fde0492e4 (patch) | |
| tree | 83ae199d6d6a21f22438ca7f50f97e2eaaaaf4c1 | |
| parent | 2b5762fc68438e4947fb15da838400da90751995 (diff) | |
Redirect to default if root is requested
| -rw-r--r-- | Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs index f09315de8..2eef223e5 100644 --- a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs +++ b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs @@ -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); } |
