728x90
Http Method 제한을 거는 이유?
- 보안 취약점이 생길 수 있기 때문에 기본적으로 사용하는 Method를 제외한 나머지를 차단
HTTP Method 종류
GET, POST, HEAD, PUT, OPTIONS, DELETE, TRACE
HTTP Method 차단 방법
tomcat > conf > web.xml 하단에 추가
<security-constraint>
<web-resource-collection>
<web-resource-name>restricted methods</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint />
</security-constraint>
결과
기본적으로 GET/POST 접속이 허용됬었지만, 해당 메서드를 적용 후 PUT 요청 시 아래와같이 403 으로 표기가 되었음

728x90
반응형
LIST
'BE > Tomcat' 카테고리의 다른 글
| Tomcat 한글 깨짐 (0) | 2024.01.16 |
|---|