Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Bean
- public CorsConfigurationSource corsConfigurationSource() {
- CorsConfiguration corsConfiguration = new CorsConfiguration();
- corsConfiguration.setAllowedHeaders(List.of("Authorization", "Cache-Control", "Content-Type", "Access-Control-Allow-Origin"));
- corsConfiguration.addAllowedOriginPattern("*");
- corsConfiguration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PUT","OPTIONS","PATCH", "DELETE"));
- corsConfiguration.setAllowCredentials(true);
- corsConfiguration.setExposedHeaders(List.of("Authorization"));
- UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
- source.registerCorsConfiguration("/**", corsConfiguration);
- return source;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement