Advertisement
Guest User

Untitled

a guest
Sep 5th, 2022
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. @Bean
  2. public CorsConfigurationSource corsConfigurationSource() {
  3. CorsConfiguration corsConfiguration = new CorsConfiguration();
  4. corsConfiguration.setAllowedHeaders(List.of("Authorization", "Cache-Control", "Content-Type", "Access-Control-Allow-Origin"));
  5. corsConfiguration.addAllowedOriginPattern("*");
  6. corsConfiguration.setAllowedMethods(List.of("GET", "POST", "PUT", "DELETE", "PUT","OPTIONS","PATCH", "DELETE"));
  7. corsConfiguration.setAllowCredentials(true);
  8. corsConfiguration.setExposedHeaders(List.of("Authorization"));
  9. UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
  10. source.registerCorsConfiguration("/**", corsConfiguration);
  11. return source;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement