목차

JBoss EAP 7 X-Frame-Options 설정

문제

설정

다음은 JBoss EAP 7에서 X-Frame-Options, X-XSS-Protection, X-Content-Type-Options, Content-Security-PolicyStrict-Transport-Security 헤더를 구성하는 단계입니다. 필요에 따라 추가합니다. 조직에서는 특정 값이 필요한지 여부에 특히 주의를 기울입니다.

XML 직접 수정

standalone.xml 또는 domain.xmlundertow subsystem의 섹션 <filters> 에 필수 응답 헤더를 추가합니다

<response-header name="x-frame-options" header-name="X-Frame-Options" header-value="SAMEORIGIN"/>
<response-header name="x-xss-protection" header-name="X-XSS-Protection" header-value="1; mode=block"/>
<response-header name="x-content-type-options" header-name="X-Content-Type-Options" header-value="nosniff"/>
<response-header name="content-security-policy" header-name="Content-Security-Policy" header-value="default-src https:"/>
<response-header name="strict-transport-security" header-name="Strict-Transport-Security" header-value="max-age=31536000; includeSubDomains;"/>

undertow subsystem의 섹션 <host>에 해당 필터 참조를 추가합니다.

<filter-ref name="x-frame-options"/>
<filter-ref name="x-xss-protection"/>
<filter-ref name="x-content-type-options"/>
<filter-ref name="content-security-policy"/>
<filter-ref name="strict-transport-security"/>

JBoss EAP를 다시 시작하고 테스트를 다시 실행하세요.

JBoss CLI를 사용하는 방법

/subsystem=undertow/configuration=filter/response-header=x-frame-options:add(header-name="X-Frame-Options",header-value="SAMEORIGIN")
/subsystem=undertow/configuration=filter/response-header=x-xss-protection:add(header-name="X-XSS-Protection",header-value="1; mode=block")
/subsystem=undertow/configuration=filter/response-header=x-content-type-options:add(header-name="X-Content-Type-Options",header-value="nosniff")
/subsystem=undertow/configuration=filter/response-header=content-security-policy:add(header-name="Content-Security-Policy",header-value="default-src https:")
/subsystem=undertow/configuration=filter/response-header=strict-transport-security:add(header-name="Strict-Transport-Security",header-value="max-age=31536000; includeSubDomains;")
/subsystem=undertow/server=default-server/host=default-host/filter-ref=x-frame-options:add()
/subsystem=undertow/server=default-server/host=default-host/filter-ref=x-xss-protection:add()
/subsystem=undertow/server=default-server/host=default-host/filter-ref=x-content-type-options:add()
/subsystem=undertow/server=default-server/host=default-host/filter-ref=content-security-policy:add()
/subsystem=undertow/server=default-server/host=default-host/filter-ref=strict-transport-security:add()

주의사항

참조링크