diff options
| author | Claus Vium <cvium@users.noreply.github.com> | 2021-06-07 23:06:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-06-07 23:06:33 +0200 |
| commit | 19a18899065aa2d50b0a989911a5f58a368b3b95 (patch) | |
| tree | 6f5b167320741c7f12e48451864472f175a0658b | |
| parent | cee8b87330916d382e223751e313be14bbddfdf4 (diff) | |
| parent | dfc776e451bcd504d35d4619ff74be2fde0492e4 (diff) | |
Merge pull request #6162 from crobibero/no-base-redirect
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); } |
