make console relative paths - #214
Conversation
There was a problem hiding this comment.
Code Review
This pull request configures the console to be served under the /console/ subpath by adding ingress routing rules, updating the Dex configuration with new redirect URIs, and modifying the frontend to use relative paths. However, a critical issue was identified where the backend's OIDC redirect URI generation does not account for the /console subpath, which will cause authentication requests to be rejected by Dex.
… 302 redirect for exact /console path
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces support for a configurable base path (--base-path) in the console server, allowing it to be hosted under a subpath like /console. It updates Kubernetes templates, Dex configurations, cookie paths, and OIDC redirect URIs to respect this base path, while updating frontend API calls to use relative paths. Feedback suggests sanitizing the BasePath configuration to prevent potential double slashes in cookie paths and redirect URIs, which could cause OIDC authentication failures.
| s.mux.HandleFunc("/info", s.HandleInfo) | ||
|
|
There was a problem hiding this comment.
Sanitize the BasePath configuration to ensure it starts with a leading slash and does not contain any trailing slashes. If a user configures --base-path with a trailing slash (e.g., /console/), it can result in double slashes in cookie paths (e.g., /console//) and redirect URIs (e.g., /console//auth/callback), which will cause OIDC authentication to fail due to redirect URI mismatch in Dex.
| s.mux.HandleFunc("/info", s.HandleInfo) | |
| s.mux.HandleFunc("/info", s.HandleInfo) | |
| if s.cfg.BasePath != "" { | |
| if s.cfg.BasePath[0] != '/' { | |
| s.cfg.BasePath = "/" + s.cfg.BasePath | |
| } | |
| for len(s.cfg.BasePath) > 0 && s.cfg.BasePath[len(s.cfg.BasePath)-1] == '/' { | |
| s.cfg.BasePath = s.cfg.BasePath[:len(s.cfg.BasePath)-1] | |
| } | |
| } |
No description provided.