2

Currently I'm upgrading some Spring MVC components from Spring 5.1.12 to Spring 5.2.2. Something that is changed in Spring 5.2 is Cors Handling. This impacts the loading of the fonts in IE9. Caching fonts in combination with IE9 is kind of unstable.

What exactly happens is that after te upgrade 3 response headers are added

Vary: Origin 
Vary: Access-Control-Request-Method
Vary: Access-Control-Request-Headers 

I tried to change the CORS policy with

Existing code:

@EnableWebMvc
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

@Override
public void addResourceHandlers(final ResourceHandlerRegistry registry) {
    ..
    registry.addResourceHandler("/fonts/**").addResourceLocations("/fonts/");
    ..
}

Added

 @Override
 public void addCorsMappings(final CorsRegistry registry) {
        registry.addMapping("/fonts/**").
        allowedOrigins("http://domain2.com").allowedMethods("PUT", "DELETE").allowedHeaders("header1", "header2", "header3").exposedHeaders("header1", "header2")

        .allowCredentials(false).maxAge(3600);
 }

But this doesn't impact the headers. How do I remove these headers for eot files, so IE9 keeps showing them correctly?

Peter N
  • 31
  • 3

0 Answers0