본문 바로가기

카테고리 없음

403에러?? SecurityConfig의 허용경로와 컨트롤러의 RequestMapping 경로는 같아야한다

SecurityConfig

에서

.requestMatchers("/api/comments/**").permitAll() // '/api/comments/'로 시작하는 요청 모두 접근 허가

sㅇ

이렇게 되어있으면 컨트롤러도

@RequestMapping("/api/comments")

d

이렇게 api/comments  이렇게 같아야 한다.

 

그냥 /comments 거나 api/comment 이렇게 조금이라도 다르면 403에러가 뜨게 되어있다