I have my server running on localhost:8080 ( spring boot app ) and my frontend on localhost:3000 ( angular app ). The problem is that I want to make a request from frontend to my backend server. I am familiar with cors, but it doesn't work form me. I added this to my server :
@Bean
WebMvcConfigurer corsConfigurer() {
return new WebMvcConfigurerAdapter() {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**").allowedOrigins("http://localhost:3000");
}
};
}
, but I still get
XMLHttpRequest cannot load http://localhost:8080/cars. The request was redirected to 'http://localhost:8080/login', which is disallowed for cross-origin requests that require preflight.
What's wrong ?