-
[에러][spring sequrity] X-Frame-Options, iframe 관련 에러에러/spring 2020. 5. 27. 10:59
무료도메인 사이트에서 도메인 포워딩 옵션에 '주소고정형'을 제공하길래 사용해보려고 했다.
주소고정형을 사용하면 무료도메인 사이트에서 만든 html에 내 사이트를 iframe 걸어서
사이트 내부에서 이동을 해도 도메인이 고정되어 보안에 좋다고 생각을 했다.
그런데 구동해보니 브라우저 콘솔에 아래와 같은 에러가 찍힌다.
Refused to display 'http://주소/' in a frame because it set 'X-Frame-Options' to 'deny'.
구글링해보면 WAS단, html단에서 수정하는 법이 많이 나와있어서 시도를 해봤는다 전부다 실패.
한참을 더 구글링하다가 이유를 찾았는데
spring sequrity에서 자체적으로 X-Frame-Options을 deny로 막아놔서 안되는 것이었다.
이를 풀기 위해서는 sequrity가 설정된 context.xml에서
<security:http> <security:headers> <security:frame-options disabled="true"></security:frame-options> </security:headers> </security:http>
<security:http> 안에 위의 내용을 추가해주니 해결되었다.
그래도 여전히 문제가 남아있는데,
브라우저 콘솔창에 아래와 같은 새로운 메시지가 뜬다.
A cookie associated with a cross-site resource at http://주소/ was set without the `SameSite` attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set with `SameSite=None` and `Secure`.
결국 CSRF에 취약해진다는 내용인거 같은데, 일단 나는 디폴트 값인 deny 상태로 두기로 했다.
'에러 > spring' 카테고리의 다른 글
[에러] spring jayspt mysql hikariConfig 프로퍼티 인식 문제 (0) 2020.05.21 [에러]org.apache.log4j.Logger cannot be resolved to a type (0) 2020.05.08 [에러]java.lang.NoSuchMethodError (0) 2020.05.06