File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
src/main/java/com/guttery/madii/common/config/security Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 2121import org .springframework .security .web .SecurityFilterChain ;
2222import org .springframework .security .web .authentication .UsernamePasswordAuthenticationFilter ;
2323import org .springframework .security .web .util .matcher .AntPathRequestMatcher ;
24+ import org .springframework .web .cors .CorsConfiguration ;
25+ import org .springframework .web .cors .UrlBasedCorsConfigurationSource ;
2426
2527import java .util .List ;
2628
@@ -77,7 +79,16 @@ public SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Excepti
7779 .sessionCreationPolicy (SessionCreationPolicy .STATELESS )
7880 )
7981 .cors (
80- Customizer .withDefaults ()
82+ cors -> {
83+ CorsConfiguration config = new CorsConfiguration ();
84+ config .addAllowedOrigin ("http://localhost:5173" );
85+ config .addAllowedOrigin ("https://9uttery.github.io" );
86+ config .addAllowedMethod ("*" );
87+ config .addAllowedHeader ("*" );
88+ UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource ();
89+ source .registerCorsConfiguration ("/**" , config );
90+ cors .configurationSource (source );
91+ }
8192 )
8293 .headers (
8394 headers -> headers .frameOptions (
You can’t perform that action at this time.
0 commit comments