diff options
| author | Cody Robibero <cody@robibe.ro> | 2021-08-07 07:36:45 -0600 |
|---|---|---|
| committer | Cody Robibero <cody@robibe.ro> | 2021-08-07 07:36:45 -0600 |
| commit | a7585dd2d65895620ab82973c9cd72991b5ed38b (patch) | |
| tree | 0b71ae6d944fbbf655d7fde4c6213321a11a353d | |
| parent | 3ee0c68cb7f0eaf028e75b73119639c2c69e9971 (diff) | |
Fix redirect logic if request path is exactly the base url
| -rw-r--r-- | Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs index 2eef223e5..e3f3911f9 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.Equals(baseUrlPrefix, StringComparison.OrdinalIgnoreCase) + // 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; |
