diff options
| author | crobibero <cody@robibe.ro> | 2020-09-07 19:10:14 -0600 |
|---|---|---|
| committer | crobibero <cody@robibe.ro> | 2020-09-07 19:10:14 -0600 |
| commit | 68e5a95fdb2d0c99e2490dc117651edb413733c5 (patch) | |
| tree | 6ebf8414cfae5c0c85fff7153bec48fb3ca1a851 /Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs | |
| parent | cd40688584a851ae7595d69f596ec0d06968f4e8 (diff) | |
Fix redirection
Diffstat (limited to 'Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs')
| -rw-r--r-- | Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs index ae3a3a1c5..9316737bd 100644 --- a/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs +++ b/Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs @@ -44,7 +44,11 @@ namespace Jellyfin.Server.Middleware var localPath = httpContext.Request.Path.ToString(); var baseUrlPrefix = serverConfigurationManager.Configuration.BaseUrl; - if (!localPath.StartsWith(baseUrlPrefix, StringComparison.OrdinalIgnoreCase)) + if (string.Equals(localPath, baseUrlPrefix + "/", StringComparison.OrdinalIgnoreCase) + || string.Equals(localPath, baseUrlPrefix, StringComparison.OrdinalIgnoreCase) + || string.Equals(localPath, "/", StringComparison.OrdinalIgnoreCase) + || string.IsNullOrEmpty(localPath) + || !localPath.StartsWith(baseUrlPrefix, StringComparison.OrdinalIgnoreCase)) { // Always redirect back to the default path if the base prefix is invalid or missing _logger.LogDebug("Normalizing an URL at {LocalPath}", localPath); |
