SolrJ: preserve proxy prefixes in v2 request URLs #5373
Automated PR readiness judgements (LLM-generated; may be wrong; not updated on later pushes).
<!-- Assessed commit 303f0b0b8fdcd697f76e8d15357e3664d5127e67 -->
Approved these changes.
Nit: a one-line javadoc stating the rule would help, since the test is now the only place that documents it: replace the last complete /solr segment, keep an existing /api root, otherwise append /api.
Nit, pre-existing: a base path with a trailing slash (/solr/, /tenant/solr/) yields /api//collections/.... The Jetty builder strips the slash, but HttpJdkSolrClient passes an override base URL straight through, so trimming a trailing / here would close it cheaply. Fine as a follow-up.
LGTM. Verified locally on the PR head: the five ClientUtilsTest cases pass, and I probed ten more bases the table doesn't cover (/solrcloud, /mysolr, /SOLR, /solr/solr, /solr/api, /api/solr, trailing-slash variants); every result is either correct or identical to what main produced before, so no regressions. This is the only /solr -> /api rewrite in SolrJ, so the fix is complete for the client path.
The two red core-test jobs fail in TestDocTermOrds.testRandom and TestLockTree.testLocks, which a SolrJ URL change can't reach; no open JIRA for either, so they look like fresh flakiness rather than this PR.
Two optional nits inline.
nick-boss-tech
epugh
V2 SolrJ requests sent through a path-prefixed proxy can rewrite the wrong part of the URL. For example,
/solr-tenant/solrbecomes/api-tenant/solrrather than/solr-tenant/api.Replace the final complete
/solrpath segment while preserving the proxy prefix and any following path. Preserve existing/apiroots. The fix applies to the shared URL builder used by the Jetty and JDK HTTP clients.Regression coverage uses a generated snapshot-list request and checks ordinary roots, proxy prefixes containing
/solr, and existing v2 roots. This is separate from the snapshot API and CLI migration in #5353.Validation: all 5
ClientUtilsTesttests,./gradlew tidy, and./gradlew check -x testpassed.Developed with assistance from OpenAI Codex.