From 9c3c387c495048766f53df7dd8abbae664536068 Mon Sep 17 00:00:00 2001 From: Lauro Correia Silveira Date: Wed, 20 Dec 2023 09:07:12 +0100 Subject: [PATCH] Setup Cros configuration to allow between railway and spring requests --- .../infraestructure/security/SecurityConfigurations.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/alura/aluraflixapi/infraestructure/security/SecurityConfigurations.java b/src/main/java/com/alura/aluraflixapi/infraestructure/security/SecurityConfigurations.java index 28641fb..c025722 100644 --- a/src/main/java/com/alura/aluraflixapi/infraestructure/security/SecurityConfigurations.java +++ b/src/main/java/com/alura/aluraflixapi/infraestructure/security/SecurityConfigurations.java @@ -62,8 +62,9 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { @Bean public CorsConfigurationSource corsConfigurationSource() { CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(List.of("https://alura-flix-api-production.up.railway.app")); - configuration.setAllowedMethods(Arrays.asList("GET","POST")); + configuration.setAllowedOrigins(List.of("*")); + configuration.setAllowedMethods(List.of("*")); + configuration.setAllowedHeaders(List.of("*")); UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); source.registerCorsConfiguration("/**", configuration); return source;