I am trying to send a custom host header using feign client, but the consumer application is not picking them. I am using spring boot feign and not openfeign.
Apart from Host, everyother header seems to be working as expected.
ResponseEntity<JSONObject> list(@PathVariable("name") String name,
@RequestParam("id") String id, @RequestParam("modelName") String modelName,
@RequestHeader(value = "Authorization", required = true) String authorizationHeader,
@RequestHeader(value = "Host", required = true) String hostName);
When i pass hostname as "xyz.com" the consumer application is still taking default host header.
In Consumer code when i read value of Host header from controller class, i do not get zyz.com. instead it picks from dns name.
Same problem happened for me - the
@Paramand@Headersdidn't work for the "Host" header. Two things that I changed solved the issue - useOkHttpClient, and add arequestInterceptorwhen building the client: