본문 바로가기
2021 웹개발 101

[Spring Boot] 에러 응답 바디가 비어있을 때. (Error response body is empty in Spring Boot 2.6)

by Senna 2021. 12. 24.

REST API 개발을 진행하던 도중..

 

403이든 404든.. 어떤 bad request에서도 response body가 텅텅 비어있었다.

 

application.properties 를 만져도 안되고..ㅠㅠ

남들은 기본으로 받는 에러 응답이라던데 왜 나는 안나와!? ㅠㅠ

 

 

https://github.com/spring-projects/spring-boot/issues/28953

 

ResponseStatusException no longer returning response body in 2.6.1 using spring security · Issue #28953 · spring-projects/spri

we found that after upgrading to spring boot 2.6.1 that the response body from the ResponseStatusException is no longer being populated even for authenticated users It looks like the spring boot fo...

github.com

위의 타래에서 해결 됨.

SpringBoot 2.6.1을 쓰고 있었고 정확히 나와 같은 증상이었다.

 

해결방법

Spring Security에서 권한 없이 접근가능한 페이지에 "/error"를 추가하는 것..

4시간을 헤맸다 이것 때문에 (억울!)

잘 나온다..!!! ㅠㅠ