Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Client-Side host load-balance #3760

Open
1 task
PiemonJ opened this issue Aug 5, 2022 · 1 comment
Open
1 task

Client-Side host load-balance #3760

PiemonJ opened this issue Aug 5, 2022 · 1 comment
Labels

Comments

@PiemonJ
Copy link

PiemonJ commented Aug 5, 2022

  • Feature Request. i have found my company use client-side ip load-balance,the http domain is a special service identifier,for example:global-user-credit,then have a common method to get ip list from register center,then perform client-side load balancing。but this special service identifier cannot be recognized by retrofit‘s HttpUrl class.so i have requirement,the OkHttpClient.Builder to provider a new method ,for example:baseUrlFactory,allows us to dynamically set base IP.
@JakeWharton
Copy link
Member

Our general policy for this has been to use an OkHttp interceptor to rewrite the Request object to target the desired host. You can use a global host at the Retrofit layer or even just use a dummy domain like example.com to ensure the interceptor is required to rewrite the URL.

In the future, we may consider a factory for base URLs which is invoked each time a request is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants