diff options
| author | Bond-009 <bond.009@outlook.com> | 2021-08-08 14:53:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-08 14:53:19 +0200 |
| commit | ab88e30cfa422a95ee07cb7a3fe44e1be4f980eb (patch) | |
| tree | 5e58900bb6efe0d71b367bb63e2f5d1f32ddd405 | |
| parent | 3ee0c68cb7f0eaf028e75b73119639c2c69e9971 (diff) | |
| parent | bdbac12d4f35bf47e75ed25c7bb10c0074e4f4ce (diff) | |
Merge pull request #6404 from crobibero/redirect-base-url
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..3e5982eed 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.Length == baseUrlPrefix.Length + // 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; |
