I'm working on a Spring Boot Backend, with a React Frontend. Locally the request comes from a different URL than the Backend (localhost:3000 to localhost:8080). Due to that, I need a Cross Origin Configuration. For simplicity, I just allowed for localhost:3000 all API's. Yet still some request get blocked.
Here is my configuration:
@Bean
CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(Arrays.asList("http://localhost:3000", "http://localhost:3001"));
configuration.setAllowedMethods(Arrays.asList("GET","POST", "PUT", "DELETE"));
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", configuration);
source.registerCorsConfiguration("/user/login", configuration);
return source;
}
Here is the error, Firefox throws: CORS error
Any help would be appreciated :)