fix(console): serve the routes under --base-path, not just at the root - #281
Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces base path normalization for the console server, ensuring that the base path flag is safely formatted with a leading slash and no trailing slash. It also updates the server routing to serve endpoints under both the root and the configured base path, and adds corresponding unit tests. The reviewer feedback suggests improving the robustness of NormalizeBasePath by using the standard library's path.Clean to handle edge cases like consecutive or leading double slashes, importing the path package, and adding additional test cases to verify these scenarios.
The console handed out URLs carrying its base path but only answered at the root, so deploying it under a prefix required whatever sits in front to strip the prefix back off — an HTTPRoute URLRewrite filter. Path rewriting is extended Gateway API conformance, so implementations may not support it (cloud-provider-kind does not), which leaves the console broken behind such gateways. The routes now also mount under the base path, and still at the root so a proxy that does strip the prefix keeps working. BasePath is concatenated into cookie paths, redirect URLs and mux patterns, so the flag value is normalized where it is read.
kaisoz
force-pushed
the
kaisoz/console-base-path
branch
from
August 17, 2026 22:56
4737a08 to
be7bcfa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The console emits URLs that include its
--base-path(cookie paths, OIDC redirect URIs, post-login redirects) but only mounts its routes at the root. Deploying it under a prefix (e.g./console/) requires the proxy in front to strip the prefix back off. In Gateway API this is performed with aHTTPRouteURLRewritefilter.URLRewritepath rewriting is extended conformance in Gateway API, not core, so it is optional and a given gateway implementation may not support it (cloud-provider-kinddoesn't , tested locally)