I know lots of posts in SO are talking about this. But I have tried half a day but still failed.
I have tried:
- add below method in my Applicationclass:
@Bean 
public WebMvcConfigurer corsConfigurer() {
    return new WebMvcConfigurer() {
        @Override
        public void addCorsMappings(CorsRegistry registry) {
            registry.addMapping("/**").allowedOrigins("*");
        }
    };
}
- add a stand alone .javafile in my project:
@Configuration
@EnableWebMvc
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**");
    }
}
3 add controller level annotation @CrossOrigin for both my controller class and the post mapping method:
@CrossOrigin
@PostMapping(value="/api/photoUpload/tester")
String tester(HttpServletRequest request) {
But my fiddler never show the wanted http resonse header. Any ideas.
 
     
    