@@ -33,8 +33,8 @@ public class SecurityConfig {
3333 @ Bean
3434 public SecurityFilterChain filterChain (HttpSecurity http ) throws Exception {
3535 http
36- .csrf (AbstractHttpConfigurer ::disable )
3736 .cors (cors -> cors .configurationSource (corsConfigurationSource ()))
37+ .csrf (AbstractHttpConfigurer ::disable )
3838 .formLogin (AbstractHttpConfigurer ::disable )
3939 .httpBasic (AbstractHttpConfigurer ::disable )
4040 .authorizeHttpRequests (auth -> auth
@@ -96,12 +96,15 @@ public CorsConfigurationSource corsConfigurationSource() {
9696 "https://gdgocinha.com" ,
9797 "https://dev.gdgocinha.com" ,
9898 "https://www.gdgocinha.com" ,
99- "https://typing-game-alpha-umber.vercel.app"
99+ "https://typing-game-alpha-umber.vercel.app" ,
100+ "https://api.gdgocinha.com" ,
101+ "https://*.gdgocinha.com"
100102 ));
101- config .setAllowedMethods (List .of ("GET" , "POST" , "PUT" , "DELETE" , "OPTIONS" , "PATCH" ));
102- config .setAllowedHeaders (
103- List .of ("Origin" , "X-Requested-With" , "Content-Type" , "Accept" , "Authorization" ));
103+ config .setAllowedMethods (List .of ("GET" ,"POST" ,"PUT" ,"DELETE" ,"OPTIONS" ,"PATCH" ));
104+ config .setAllowedHeaders (List . of ( "Origin" , "X-Requested-With" , "Content-Type" , "Accept" , "Authorization" ));
105+ config . setExposedHeaders ( List .of ("Authorization" , "Set-Cookie" )); // 필요시 노출
104106 config .setAllowCredentials (true );
107+ config .setMaxAge (3600L ); // 프리플라이트 캐시
105108
106109 UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource ();
107110 source .registerCorsConfiguration ("/**" , config );
0 commit comments