Back
Open Source

Argo CD under a subpath: the anonymous login link that forgot basehref

Argo CD #31267 fixed anonymous login links on installations served under a URL prefix by building the URL through requests.toAbsURL.

JB
Josué Barros
••2 min read

The anonymous Log In URL was built without respecting server.basehref or server.rootpath. On an Argo CD installation served under a subpath, the login link could send the user to the wrong place, or fail to return them to the intended page after sign-in.

This is one of the pull requests behind Six merged PRs in 72 hours. The series looks at the failure, the fix and the review evidence, one merge at a time.

The change: +19 / -2 across 2 files. PR 31267.

The bug

The default installation works at the root, so the bug is easy to miss. A subpath deployment changes the URL contract: every generated link has to include the prefix, not just the routes that the router already handles.

The issue is a classic split between “the path I know” and “the base path the deployment is mounted under.” The browser follows the first string it is given.

Why it mattered

Login is the first interaction a new operator has with the UI. A broken link under a subpath looks like a broken Argo CD installation, even though the API and the rest of the UI may be healthy. The failure is also hard to reproduce for maintainers who run at the root.

The fix

Build the anonymous Log In URL through requests.toAbsURL so server.basehref and server.rootpath are respected. The change is two files, 19 additions and 2 deletions, with a regression test for the subpath case.

The evidence

The regression test makes the deployment shape part of the contract. It does not test a helper in isolation; it tests the URL that the user follows. That is the right level for a routing bug.

What I would repeat

If a product supports subpath deployments, every generated URL is part of the contract. Add one test that mounts the app under a prefix, and build URLs through the project’s own URL helper instead of string concatenation.

Sources

If this was useful, connect with me on LinkedIn; I write about the bugs behind merged pull requests and the evidence that gets them accepted.

FAQ

What was broken in Argo CD anonymous login?
The login URL ignored server.basehref and server.rootpath, so installations served under a subpath could navigate to the wrong login page or lose the return destination.
How was it fixed?
The URL is now built with requests.toAbsURL, which respects the configured base path.
What test was added?
A regression test for the subpath case, alongside the normal root-path behavior.
#argo-cd#kubernetes#ui#routing#open-source

Join the Newsletter

Subscribe to get my latest content by email.

We won't send you spam. Unsubscribe at any time.