[웹 보안] Apache에서 보안 헤더 설정 방법 [HttpOnly, Content-Security-Policy, X-Content-Type-Options, X-Frame-Options, X-XSS-Protection]
·
◈ Study/웹 보안(Web Security)🔐
- Apache에서 보안 헤더 설정 방법아래는 Apache 설정 파일 또는 .htaccess 파일에 추가할 수 있는 설정이다. # HttpOnly 및 Secure 속성 추가 Header always edit Set-Cookie ^(.*)$ "$1; HttpOnly; Secure" # Content-Security-Policy 헤더 설정 Header set Content-Security-Policy "default-src 'self'; script-src 'self';" # X-Content-Type-Options 헤더 설정 Header set X-Content-Type-Options "nosniff" # X-Frame-Options 헤더 설정 Header set..
[JAVA] 서블릿 필터 코드로 보안 헤더 설정하기 [HttpOnly, Content-Security-Policy, X-Content-Type-Options, X-Frame-Options, X-XSS-Protection]
·
◎ Java/Java☕
- 서블릿 필터 코드로 보안 헤더 설정하기 아래는 보안 헤더를 한 번에 설정하는 통합 서블릿 필터 코드이다. 이 필터는 HttpOnly, Content-Security-Policy, X-Content-Type-Options, X-Frame-Options, X-XSS-Protection를 모든 응답에 적용한다.HttpOnly: Set-Cookie 헤더에 HttpOnly 속성을 추가하여 모든 쿠키에 대해 적용되도록 설정X-Content-Type-Options: 브라우저가 MIME 타입을 스니핑하지 않도록 설정X-Frame-Options: 클릭재킹 방지를 위해 페이지가 내에 표시되지 않도록 설정X-XSS-Protection: 브라우저에서 XSS 필터를 활성화Content-Security-Policy: 외부 ..