Skip to content

refactor(server): unify URL configs when scheme is missing#2944

Merged
imbajin merged 11 commits intoapache:masterfrom
bitflicker64:fix-url-normalization
Feb 3, 2026
Merged

refactor(server): unify URL configs when scheme is missing#2944
imbajin merged 11 commits intoapache:masterfrom
bitflicker64:fix-url-normalization

Conversation

@bitflicker64
Copy link
Copy Markdown
Contributor

@bitflicker64 bitflicker64 commented Jan 23, 2026

Purpose of the PR

  • close [Improvement] unify endpoint URL format #2942
  • Some server URL configs currently require an explicit scheme (http:// / https://). If a user sets something like 127.0.0.1:8080, it can fail to parse or behave inconsistently compared to other modules that already default the scheme.

This PR fixes that by normalizing only the relevant server URL options: if the scheme is missing, we auto-prefix a sensible default, while leaving explicitly provided schemes untouched.

Also covered the review corner case: server.k8s_url should default to https:// (so we don’t accidentally downgrade it to http://).

Main Changes

HugeConfig.get(...) now applies URL normalization for a small allowlist of keys:

  • restserver.url → default http://
  • gremlinserver.url → default http://
  • server.urls_to_pd → default http://
  • server.k8s_url → default https://

Normalization only triggers when:

  • the config key is in the allowlist, and
  • the value is a String, and
  • the value has no scheme

If the value already starts with http:// or https://, it’s left as-is.
Non-string config values are untouched.

Verifying these changes

  • Trivial rework / code cleanup without any test coverage. (No Need)
  • Already covered by existing tests, such as (please modify tests here).
  • Need tests and can be verified as follows:
    Tests are included and you can verify the behavior like this:
  • Added unit tests in HugeConfigTest covering:

    • missing scheme → default prefix is added
    • existing scheme → preserved as-is
    • server.k8s_url missing scheme → becomes https://... (no accidental downgrade)

Does this PR potentially affect the following parts?

Documentation Status

  • Doc - TODO
  • Doc - Done
  • Doc - No Need

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files. tests Add or improve test cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Improvement] unify endpoint URL format

3 participants