Advertisement
Guest User

Untitled

a guest
May 7th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.60 KB | None | 0 0
  1. @Configuration
  2. public class MyCorsFilter extends CorsFilter {
  3.  
  4.     public MyCorsFilter() {
  5.         super(configurationSource());
  6.     }
  7.  
  8.     private static UrlBasedCorsConfigurationSource configurationSource() {
  9.         CorsConfiguration config = new CorsConfiguration();
  10.         config.setAllowCredentials(true);
  11.         config.addAllowedOrigin("*");
  12.         config.addAllowedHeader("*");
  13.         config.addAllowedMethod("*");
  14.         UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
  15.         source.registerCorsConfiguration("/**", config);
  16.         return source;
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement