Skip to content

Commit

Permalink
Merge pull request jellyfin#6162 from crobibero/no-base-redirect
Browse files Browse the repository at this point in the history
Redirect to default if root is requested
  • Loading branch information
cvium authored Jun 7, 2021
2 parents cee8b87 + dfc776e commit 19a1889
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Jellyfin.Server/Middleware/BaseUrlRedirectionMiddleware.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ public async Task Invoke(HttpContext httpContext, IServerConfigurationManager se
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);
}
Expand Down

0 comments on commit 19a1889

Please sign in to comment.