Skip to content

fix(console): serve the routes under --base-path, not just at the root - #281

Merged
aojea merged 1 commit into
google:mainfrom
kaisoz:kaisoz/console-base-path
Aug 18, 2026
Merged

fix(console): serve the routes under --base-path, not just at the root#281
aojea merged 1 commit into
google:mainfrom
kaisoz:kaisoz/console-base-path

Conversation

@kaisoz

@kaisoz kaisoz commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

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 a HTTPRoute URLRewrite filter.

URLRewrite path rewriting is extended conformance in Gateway API, not core, so it is optional and a given gateway implementation may not support it (cloud-provider-kind doesn't , tested locally)

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/console/server.go Outdated
Comment thread internal/console/server.go
Comment thread internal/console/server_test.go
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
kaisoz force-pushed the kaisoz/console-base-path branch from 4737a08 to be7bcfa Compare August 17, 2026 22:56
@kaisoz kaisoz changed the title console: serve the routes under --base-path, not just at the root fix(console): serve the routes under --base-path, not just at the root Aug 17, 2026
@aojea
aojea merged commit 3e0061d into google:main Aug 18, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants