Hello all,
from few days we noticed that we are unable to load in the map our custom KML.
We are facing always a cors error that we aren't able to explain.
This is our current Spring boot configuration:
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.securityMatcher("/**")
.cors((cors) -> cors.configurationSource(apiConfigurationSource()))
.csrf(CsrfConfigurer::disable);
return http.build();
}
CorsConfigurationSource apiConfigurationSource() {
CorsConfiguration configuration = new CorsConfiguration();
configuration.setAllowedOrigins(List.of("*"));
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "HEAD", "OPTIONS"));
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/map/**", configuration);
return source;
}
And this is he configuration on the single endpoint that the map is trying to load:
@CrossOrigin(origins = "https://map.geo.admin.ch")
@GetMapping("/map/kml")
public void createKml(@RequestParam("id") String id, @RequestParam("distance") int distance, @RequestParam("lang") String lang, @RequestParam(name = "withDescription", required = false, defaultValue = "false") Boolean withDescription, @RequestParam(name = "showNames", required = false, defaultValue = "false") Boolean showNames, HttpServletRequest request, HttpServletResponse response) {
/** BODY **/
}
Do you have any idea why is not possible to load it? Has something changed on your side?
Best regards,
Giuseppe Riccardi