0👍
Try this inside a WebSecurityConfigurerAdapter
(worked for me)
@Override
protected void configure(HttpSecurity http) throws Exception {
http.csrf()
.disable()
.cors()
//....
;
}
@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setMaxAge(Long.MAX_VALUE);
configuration.setAllowCredentials(true);
configuration.addAllowedHeader("*");
configuration.addAllowedOrigin("*");
configuration.addAllowedMethod("*");
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
return source;
}
0👍
The Problem is from the backend, you need to enable cors on your backend server
please follow these steps from the official spring website :
https://spring.io/guides/gs/rest-service-cors/#_enabling_cors
Thank you and I hope this answer be useful
- [Vuejs]-Vuejs does not update the DOM if the data is fetched over HTTPS
- [Vuejs]-Cannot run addEventListener (resize) in VueJS CLI to get screen width
Source:stackexchange.com