square / retrofit

A type-safe HTTP client for Android and the JVM
https://square.github.io/retrofit/
Apache License 2.0
42.93k stars 7.29k forks source link

Client-Side host load-balance #3760

Open PiemonJ opened 2 years ago

PiemonJ commented 2 years ago
JakeWharton commented 1 year ago

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.