When building the Eureka service of springcloud, security was introduced for security. However, it was found that the Eureka client could not register. The error log is as follows:
DiscoveryClient_ EUREKA-CLIENT/10.168.211.109:8001 – was unable to send heartbeat!
Later, I inquired about the Security version of the project (spring boot starter security in version 2.3.2.release introduces the security configuration of 5.3. X). If the version is too high, it will be changed by default When CSRF (Cross Site Request Forgery) is turned on, you need to turn it off. The steps are as follows:
Add the following code into the startup file:
@EnableWebSecurity
static class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf().disable(); // Close csrf
super.configure(http);
}
}
The test is effective.
Read More:
- Feignexception $unauthorized is reported by introducing security call service
- An error is reported in the spring cloud setup. Autowired appears and Eureka cannot be registered
- [Solved] Error in registering Eureka for spring cloud micro service: classnotfoundexception: org.apache.http.conn.scheme.schemeregistry
- Connection authorization failure occurred. Reason: local security service non retryable error solution
- Solve the problem that comdlg32.ocx, mscomm32.ocx and other controls cannot be registered under WIN7 64-bit system
- After introducing sass into Vue project, start to report error typeerror [err]_ INVALID_ ARG_ Type]: the “path” argument must be of type string
- nt service 1072 No need to restart, repeat the method of installing the service program or service driver
- Can’t Dubbo’s @ service be injected into the spring container?
- Common errors reported by Eureka in spring cloud
- Eureka starts abnormally and prompts FreeMarker template error
- Introducing pair in Java
- Spring security failed to log in, error: there is no passwordencoder mapped for the ID “null”
- Springboot: start error reporting after introducing paging plug-in PageHelper
- Chrome setting — Disable web security to solve cross domain problems
- Introducing external configuration files into spring XML db.properties
- Eureka server startup error: cannot execute request on any known server
- egg.js The frame post request reported an error of invalid CSRF token security verification, which has been solved
- Systemctl command doesn’t exist. How to solve the problem that the service can’t be started
- quill Cannot import ImageResize. Are you sure it was registered?
- Eureka failed to register error: saw local status change event statuschangeevent