0

I'm currently using version 4.9.1 of okhttp3. I have a use-case where I need to be able to set the "Host" request header to a value that is different than the host:port specified in the request URL. It appears that okhttp doesn't allow me to simply set this header as part of the request. How can one do this with okhttp? Thanks in advance

Phil Adams
  • 97
  • 9

1 Answers1

1

Set the host header on the request and OkHttp will honor it.

Jesse Wilson
  • 39,078
  • 8
  • 121
  • 128
  • Thanks @jesse-wilson, I should have responded to this sooner. I had been using an older version of okhttp3 until recently. It turns out that setting the Host header is not a problem in the latest release. – Phil Adams Jun 28 '21 at 18:39