개발도구/WAS

Disable HTTP Methods in Tomcat

노루아부지 2019. 12. 30. 18:07

보안상의 이유로 HTTP의 Method를 제한해야 할 경우가 있습니다.

HTTP의 메소드는 GET, POST, PUT, DELETE, HEAD, TRACE, OPTIONS 이렇게 총 7개 인데

일반적으로 GET, POST를 제외한 모든 METHOD를 막는다고 합니다.

 

WEB-INF/web.xml 또는 tomcat/conf/web.xml에 넣고 tomcat을 재시작하면 됩니다.

<security-constraint>
    <web-resource-collection>
        <web-resource-name>Protected Context</web-resource-name>
        <url-pattern>/*</url-pattern>
        <http-method>PUT</http-method>
        <http-method>DELETE</http-method>
        <http-method>HEAD</http-method>
        <http-method>TRACE</http-method>
        <http-method>OPTIONS</http-method>
    </web-resource-collection>
    <auth-constraint />
</security-constraint>

 

728x90
loading