SpringBoot
[ERROR] Mixed Content: The page at...
얀타호수
2023. 4. 11. 09:29
안녕하세요.
오늘은 브라우저 console에 찍히는 문제 해결에 대해 알아보겠습니다.
해당 Mixed Content 에러 발생 문구
Mixed Content: The page at '<URL>' was loaded over HTTPS, but requested an insecure element '<URL>'. This request was not upgraded to HTTPS because its URL's host is an IP address.
이 문제가 발생하는 이유는
보안 적용이 된 https사이트 에서 ajax를 사용해 async로 http 사이트에 request를 요청해 문제가 발생하는 거였습니다.
보안 암호화 적용이 된 https 기반의 사이트에서 암호화되지 않은 요청을 보내 Mixed content 에러가 발생했습니다.
문제 해결
html파일 head 태그안에 아래 meta 태그를 추가합니다.
<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">
console창에 더이상 해당 에러 문구가 뜨지 않음을 알 수 있습니다.
감사합니다.