Overwrite HOST header in okhttp request
<p>I am using okhttp to send some http request from my Android APK. Due to some server-side proxy requirement, I would like the url endpoint to be like: "<a href="https://api.example.com" rel="nofollow">https://api.example.com</a>", however in the http request, I would like to overwrite the HOST header to be "Host: proxy.example.com". I tried to use something like:</p>

<pre><code>    HttpUrl url = new HttpUrl.Builder()
      .scheme("https")
      .host("api.example.com")
      .build();

    okhttprequest = new com.squareup.okhttp.Request.Builder()
      .url(url)
      .method("GET", requestBody)
      .header("Host", "proxy.example.com")
      .build();

    response = mOkHttpClient.newCall(okhttprequest).execute();
</code></pre>

<p>However, when I looked into the http request in the network packages, the HOST header was still "api.example.com". Just wonder, any advice that I can actually overwrite the HOST header? Thanks a lot!</p>