title: Feign Client Throwing Unauthorized Exception for Url, where authentication is not needed
body: <p>I have followed this <a href="https://medium.com/omarelgabrys-blog/microservices-with-spring-boot-intro-to-microservices-part-1-c0d24cd422c3" rel="nofollow noreferrer">blog</a> and have created few microservices: Eureka-server,Auth-service,Zuul-service,Gallery-service,Image-service.
  From the gallery service I wanted to invoke auth-service API using Feign-Client
  The url doesn't require authentication but the client throws FeignException$Unauthorized
  I'm using JWT tokens for authentication.</p>
  
  <pre class="lang-java prettyprint-override"><code>//AuthServerProxy.java
  
  @FeignClient(name = "auth-service")
  @RibbonClient(name = "auth-service")
  public interface AuthServiceProxy {
  
      @PostMapping("/auth/authenticate")
      public ResponseEntity&lt;?&gt; authenticate(@RequestBody UserEntity userEntity);
  
      @GetMapping("/auth/register")
      public String test();
  }
  </code></pre>
  
  <p>Controller - Gallery Service</p>
  
  <pre class="lang-java prettyprint-override"><code>@Autowired
      AuthServiceProxy authServiceProxy;
      @GetMapping("/test")
      public String test(){
          UserEntity userEntity = new UserEntity();
          userEntity.setUsername("admin");
          userEntity.setPassword("admin");
          ResponseEntity&lt;?&gt; responseEntity = authServiceProxy.authenticate(userEntity);
          System.out.println(responseEntity.getStatusCode());
          return responseEntity.toString();
  
      }
  
      @GetMapping("/test/str")
      public String testStr(){
          return authServiceProxy.test();
      }
  </code></pre>
  
  <p>Security Config - ZuulServer, Auth-Service</p>
  
  <pre><code>.antMatchers(HttpMethod.POST, "/auth/authenticate").permitAll()
  </code></pre>
  
  <p>This is the error log</p>
  
  <pre><code>ERROR 1123 --- [nio-8100-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.FeignException$Unauthorized: status 401 reading AuthServiceProxy#authenticate(UserEntity)] with root cause
  
  feign.FeignException$Unauthorized: status 401 reading AuthServiceProxy#authenticate(UserEntity)
  at feign.FeignException.errorStatus(FeignException.java:94) ~[feign-core-10.2.3.jar:na]
      at feign.FeignException.errorStatus(FeignException.java:86) ~[feign-core-10.2.3.jar:na]
      at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:93) ~[feign-core-10.2.3.jar:na]
      at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:149) ~[feign-core-10.2.3.jar:na]
      at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:78) ~[feign-core-10.2.3.jar:na]
      at feign.ReflectiveFeign$FeignInvocationHandler.invoke(ReflectiveFeign.java:103) ~[feign-core-10.2.3.jar:na]
      at com.sun.proxy.$Proxy101.authenticate(Unknown Source) ~[na:na]
      at com.test.gallery.Controller.test(Controller.java:47) ~[classes/:na]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_201]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_201]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_201]
      at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_201]
      at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138) ~[spring-web-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:892) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:797) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1039) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897) ~[spring-webmvc-5.1.9.RELEASE.jar:5.1.9.RELEASE]
  ...
  </code></pre>
  
  <p>Any help much appreciated.
  TIA</p>