Skip to content

Commit

Permalink
Setup Cros configuration to allow between railway and spring requests (
Browse files Browse the repository at this point in the history
  • Loading branch information
LauroSilveira committed Dec 20, 2023
1 parent a094ecc commit 96fc105
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class SecurityConfigurations {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
//disable cross site request forgery
return http.csrf(AbstractHttpConfigurer::disable)
return http.csrf(csrf -> csrf.ignoringRequestMatchers("/login/**") )
//Disable Spring control and allow all endpoints
.sessionManagement(managementConfigurer ->
managementConfigurer.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
Expand All @@ -55,19 +55,20 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
}


/**
/* *//**
* Configure Cross
* @return CorsConfigurationSource
*/
*//*
@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;
}
}*/


/**
Expand Down

0 comments on commit 96fc105

Please sign in to comment.