Closed ymmihw closed 5 years ago
If you just make a POST request to the service app without feign (just using curl for example) it also fails with a 401 so I dont think it has anything to do with feign. You spring security config probably needs to be adjusted
thanks for reply.
my client runs on 8080, and service on 9090. client use feign and basic auth interceptor call service endpoint.
if i make a GET request to client, the behavior is correct. but POST request or GET request with param is not.
maybe i missunderstand some concept of feign.
thanks
spring securiy enables csrf protection, i will try to disable it.
Was that issue resolved after disabling the CSRF protection?. I am also getting the same exception while calling REST API using feign client.
Was that issue resolved after disabling the CSRF protection?. I am also getting the same exception while calling REST API using feign client.
yes.
CSRF protection may cause this issue
how to disable the CSRF protection?
how to disable the CSRF protection?
write the below line in your configuration class. http.csrf().disable();
even I've disabled the csrf protection, this problem also happened...
Is there any yml
configuration to pass headers to FeignClient
so that no manual configuration is needed?
Here's my solution. It's not safe but it worked:
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
@Configuration
public static class ApiWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
public void configure(WebSecurity web) throws Exception {
web.ignoring().antMatchers(
"/yourfeign/api",
"/otherfeign/noneedtoauth"
);
}
}
cloud Finchley.SR2 boot 2.0.5
i have a client and a basic auth protected service. the client can access GET endpoint, but when access POST endpoint feign throws:
moreover, access the GET endpoint with param also failed with same exception.
thank you for help.
the code samples are available over on Github.