title: How to pass header in feign client especially HTTP Headers?
body: <p>I tried with Rest Template passing http headers and its working as expected but some how it not working with feign client.</p>
  
  <p>Rest Client code:-</p>
  
  <pre><code>import org.springframework.http.HttpHeaders;
  
  RestTemplate restTemplate = new RestTemplate();
  HttpHeaders httpHeader = new HttpHeaders();
  httpHeader.set("appsecret-proof", header);
  HttpEntity&lt;?&gt; request = new HttpEntity&lt;&gt;(httpHeader);
  String url = "https://localhost/groups/{pathVariable}/members/";
  Map&lt;String, String&gt; map = new HashMap&lt;&gt;();
  map.put("pathVariable", pathVariable);
  UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url)
                                                     .queryParam("token", token);
  String uriBuilder = builder.build().toString();
  
  ResponseEntity&lt;MemberObject&gt; responseEntity = restTemplate.exchange(uriBuilder, HttpMethod.POST, request,MemberObject.class, map);
  
  MemberObject memberObject = null;
  if (responseEntity != null &amp;&amp; responseEntity.getBody() != null) {
      memberObject = responseEntity.getBody();
  }
  </code></pre>
  
  <p>Fegin Client Code:-</p>
  
  <pre><code>import org.springframework.web.bind.annotation.RequestHeader;
  
  @PostMapping(value = "/groups/?token=xyz")
  MemberObject getMemberGroup(@RequestHeader("appsecret-proof") String appsecretProof);
  </code></pre>
  
  <p>But fegin client giving an error as :</p>
  
  <pre><code>{"error":{"message":"Authentication credentials could not be found.","type":"Authentication Error","code":404,"sub_code":0}}.
  </code></pre>
  
  <p>Hardcoded the token in feign client still its giving an same error. It might be error with headers....any suggestion how to setup header in feign client. </p>