Develop/Spring
[Spring Boot] Request method 'DELETE' not supported
연로그
2021. 1. 20. 12:53
반응형
Request method 'DELETE' not supported
@DeleteMapping을 이용해 게시글 삭제 기능을 구현하고 있었는데, 405 에러가 떴다.
Spring boot에서 put, delete 요청에서 @DeleteMapping이나 @PutMapping을 사용할 경우에는 application.properties에 다음 설정을 추가해야한다.
spring.mvc.hiddenmethod.filter.enabled=true
다만, 추가적인 이슈가 있다면 tomcat과 연동해 사용할 경우에는 request의 body 내용을 HTTP POST Method일 때만 파싱해올 수 있다
tomcat에서 설정을 바꿔주거나 스프링에서 제공하는 필터 등을 사용하면 된다. (방법은 참고2 링크)
참고
반응형