1년 전에 겪은 오류지만 개인 노션에 정리해놨길래 공익을 위해 블로그 글로 발행하기로 했다.
오류명
Page load failed with error: The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.
원인 파악
- Tomcat 서버를 실행하고 프로젝트 추가하여 Run As하면 해당 메세지가 나타난다.
- eclipse에서 일어나는 오류로 검색하면 xcode에서 주로 나타나는 오류.
- 앱 프로젝트 내에서 Info.plist 파일을 편집하라는 해결책을 구글링을 통해 찾았으나 워크스페이스에 작성해도, 프로젝트 내에 작성해도 같은 오류가 발생함.
- apple의 ATS 보안정책이
https
는 허용하고http
는 허용하지 않아서 발생하는 문제로 추정됨. - eclipse 설정변경으로 해결되는 문제이므로 run as tomcat 하고 웹브라우저에서 로컬호스트 접속하면 접속됐을 가능성이 높다. 그냥 이클립스 자체 브라우저에서만 허용안되는 문제일 수 있음.
해결책
1. Run 했을 때 실행되는 브라우저를 다른 외부 브라우저로 변경할 수 있다.
- 이 방법을 사용하지 않았으므로 다른 블로그 링크를 첨부한다.
그 땐 이게 되는 줄 몰랐다. - https://needneo.tistory.com/123
[Eclipse] 외부 브라우저 선택하기
이클립스(Eclipse)에서 웹개발을 진행할 때, 이클립스에서 브라우저(Browser)를 띄우면 크롬(Chrome)이나 에지(Edge)와 같은 성능 좋은 외부 브라우저가 아니라 자체적으로 내장된 내부 브라우저로 실행
needneo.tistory.com
2. Eclipse 의 Info.plist 파일 수정
/Applications/Eclipse.app/Contents/Info.plist
에 해당 스크립트를 추가하면 해결된다.http
를 모두 허용해주는 문장이므로 보안에 주의yourdomain.com
이하는 필요없어 보인다. 반대로<key>
속성에localhost.com
을 지정해서 localhost 만 허용 해주는 것도 괜찮을 것 같다.
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>4
<key>NSExceptionDomains</key>
<dict>
<key>yourdomain.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
</dict>
</dict>
- 적용한 스크린샷
참고 자료
Cocoa Keys
Cocoa Keys Cocoa and Cocoa Touch are the environments used to define apps that run in macOS, iOS, tvOS, and watchOS. The keys associated with the Cocoa environments provide support for Interface Builder nib files and provide support for other user-facing f
developer.apple.com
- 애플 개발자 페이지에서 각 스크립트 속성의 의미를 알 수 있다.
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection
I have solved it with adding some key in info.plist. The steps I followed are: Opened my Project target's info.plist file Added a Key called NSAppTransportSecur
newbedev.com
- 붙여넣은 스크립트의 원본
https://developer.apple.com/news/?id=jxky8h89
Fine-tune your App Transport Security settings - Discover - Apple Developer
Transport Layer Security (TLS) uses encryption to protect connections from prying eyes, and URLSession provides strong TLS connections by default with App Transport Security (https://developer.apple.com/documentation/bundleresources/information_property_li
developer.apple.com
- ATS 라는 것이 뭐고 왜 필요한지?
slobell blog : [iOS] HTTP 허용하기
iOS에서 Info.plist 파일을 수정하여 임시로 http 통신을 허용하는 방법에 대해 설명한다.
slobell.com
https://shanepark.tistory.com/32
Eclipse 설치시 Failed to create the Java Virtual Machine 해결법
높은 버전의 jdk 를 추가로 설치하셔서 이 문제를 해결하는 것을 가장 추천하지만, 자바를 추가로 설치하지 않고 보유하고 있는 jre로 이클립스를 실행하는 방법을 원한다면 아래 글을 쭉 읽으시
shanepark.tistory.com
- 해결법의 실마리를 찾은 곳들
'tools' 카테고리의 다른 글
[Chrome] 모든 웹페이지에 커서가 나타나는 현상 해결 및 Vimium 소개 (0) | 2023.02.11 |
---|