Created
March 12, 2016 13:19
-
-
Save Guvenir/9111c21b2e9749f6f82d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class RestConfiguration { | |
@Bean | |
public CorsFilter corsFilter() { | |
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); | |
CorsConfiguration config = new CorsConfiguration(); | |
config.setAllowCredentials(true); // you USUALLY want this | |
config.addAllowedOrigin("*"); | |
config.addAllowedHeader("*"); | |
config.addAllowedMethod("GET"); | |
config.addAllowedMethod("PUT"); | |
source.registerCorsConfiguration("/**", config); | |
return new CorsFilter(source); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment