반응형
가장 중요한 것은 아무리 html meta태그에 csp를 추가해도
아래와 같이 contentSecurityPolicy가 적용 우선 순위가 높다.
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.headers()
.contentSecurityPolicy(
그리고 만약 contentSecurityPolicy에 적용했는데도 적용이 안되면
다른 설정파일이 더 있는지 체크...
그리고
http
.headers()
.contentSecurityPolicy(
"default-src 'self' 'unsafe-inline'; "
+ "script-src 'self'; "
+ "object-src 'none'; "
+ "base-uri 'none'; "
+ "img-src www.naver.com 'self' data:; "
+ "connect-src *; "
);
이런식으로 img-src에 www.naver.com url만 추가하면 됨.
https 붙여도 되고 www.naver.com/ 해도 되지만
주의할 것이 'self' 추가해야 하고 data할 때 data >>>>: <<<< 추가해야 함.
반응형
'IT' 카테고리의 다른 글
스프링시큐리티 인액션 8장 (0) | 2023.08.04 |
---|---|
파이썬 1260번 (0) | 2023.08.01 |
request-entity-too-large client intended to send too large body (0) | 2023.07.31 |
스프링시큐리티 7장 (0) | 2023.07.28 |
jquery.filedownload.js 파일 한글깨짐 현상 (0) | 2023.07.28 |