이번에 react와 자바를 이용해서 로그인을 구현해 보고 있습니다. 그런데 자바에서 타임리프를 사용할때와는 다르게 설정이 몇개
변경 되어야 하는 것 같은데 인터넷을 찾아보고 csrf를 disable 하는것도 따라 해보았지만 계속 302 found와 요청 메서드가 OPTION
으로 설정된 요청이 추가로 전송되고 있습니다.
스프링 SecurityFilterChain 코드
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http.csrf((csrf) -> csrf.disable());
http.csrf(httpSecurityCsrfConfigurer -> httpSecurityCsrfConfigurer.disable());
http.formLogin((formLogin) -> formLogin.loginPage("/admin/Login")
);
http.authorizeHttpRequests((authorize) ->
authorize.requestMatchers("/**").permitAll()
);
return http.build();
}
클라이언트 코드
const response = await client.post(
"http://localhost:8081/admin/Login",
{
userId: emailValue,
password: passwordValue,
},
{
headers: {
"Content-Type": "application/x-www-form-urlencoded",
"Cache-Control": "no-cache",
},
}
);
클라이언트 요청 정보( 한번 전송한 결과 )