[iOS] ๐Ÿšจ https์•ˆ์“ฐ๊ณ  http์“ฐ๋ฉด ์ƒ๊ธฐ๋Š” ์ผ:

Madeline๐Ÿ‘ฉ๐Ÿปโ€๐Ÿ’ปยท2024๋…„ 3์›” 11์ผ
1

iOS study

๋ชฉ๋ก ๋ณด๊ธฐ
39/61
post-custom-banner

๐Ÿ‘ฉ๐Ÿปโ€๐Ÿš’ย ํŠธ๋Ÿฌ๋ธ”์ŠˆํŒ…

insomnia์—๋Š” http๋กœ ํ•ด๋„ ์ž˜ ๋ฐ›์•„์™€์ง€๋˜๋ฐ..

url์— https์•ˆ์“ฐ๊ณ  http์“ฐ๋ฉด ์ƒ๊ธฐ๋Š” ์ผ:

sessionTaskFailed(error: Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection." UserInfo={NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection., NSErrorFailingURLStringKey=http://www.dhlottery.co.kr/common.do?method=getLottoNumber&drwNo=1109, NSErrorFailingURLKey=http://www.dhlottery.co.kr/common.do?method=getLottoNumber&drwNo=1109, _NSURLErrorRelatedURLSessionTaskErrorKey=(
    "LocalDataTask <47FD106D-6184-4419-A134-B9462FAEE627>.<1>"
), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <47FD106D-6184-4419-A134-B9462FAEE627>.<1>, NSUnderlyingError=0x600000c75c20 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}})

์™œ ์ƒ๊ธฐ๋‚˜?

HTTP(HyperText Transfer Protocol)์™€ HTTPS(HyperText Transfer Protocol Secure)๋Š” ์„œ๋ฒ„์™€ ํด๋ผ์ด์–ธํŠธ ๊ฐ„์— ๋ฐ์ดํ„ฐ๋ฅผ ์ฃผ๊ณ ๋ฐ›๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋˜๋Š” ํ”„๋กœํ† ์ฝœ.

์ฃผ์š” ์ฐจ์ด์ ์€ ๋ฐ์ดํ„ฐ ์ „์†ก ์‹œ ๋ณด์•ˆ ์ˆ˜์ค€์— ์žˆ๋‹ค.

HTTP

  • ๋น„์•”ํ˜ธํ™”: HTTP๋Š” ๋ฐ์ดํ„ฐ๋ฅผ ํ‰๋ฌธ์œผ๋กœ ์ „์†กํ•œ๋‹ค. ์ด๋Š” ์ค‘๊ฐ„์ž(ํ•ด์ปค, ISP ๋“ฑ)๊ฐ€ ๋„คํŠธ์›Œํฌ ํŠธ๋ž˜ํ”ฝ์„ ๊ฐ์ฒญํ•  ๊ฒฝ์šฐ, ์ „์†ก๋˜๋Š” ์ •๋ณด(๋กœ๊ทธ์ธ ์ž๊ฒฉ ์ฆ๋ช…, ๊ฐœ์ธ ์ •๋ณด ๋“ฑ)๋ฅผ ์‰ฝ๊ฒŒ ์ฝ์„ ์ˆ˜ ์žˆ์Œ์„ ์˜๋ฏธํ•œ๋‹ค.
  • ํฌํŠธ 80: ์ผ๋ฐ˜์ ์œผ๋กœ HTTP ํ†ต์‹ ์€ 80๋ฒˆ ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.

HTTPS

  • ์•”ํ˜ธํ™”: HTTPS๋Š” SSL(Secure Socket Layer) ๋˜๋Š” TLS(Transport Layer Security) ํ”„๋กœํ† ์ฝœ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์•”ํ˜ธํ™”ํ•œ๋‹ค. ์ด๋กœ ์ธํ•ด ๋ฐ์ดํ„ฐ๊ฐ€ ์•”ํ˜ธํ™”๋˜์–ด ์ „์†ก๋˜๋ฏ€๋กœ, ์ค‘๊ฐ„์ž๊ฐ€ ๋ฐ์ดํ„ฐ๋ฅผ ๊ฐ์ฒญํ•˜๋”๋ผ๋„ ์ •๋ณด๋ฅผ ํ•ด๋…ํ•˜๋Š” ๊ฒƒ์ด ๋งค์šฐ ์–ด๋ ต๋‹ค.
  • ํฌํŠธ 443: HTTPS ํ†ต์‹ ์€ ๋ณดํ†ต 443๋ฒˆ ํฌํŠธ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค.
  • ์ธ์ฆ์„œ: HTTPS๋Š” ์›น ์„œ๋ฒ„์˜ ์‹ ๋ขฐ์„ฑ์„ ํ™•์ธํ•˜๊ธฐ ์œ„ํ•ด ์ธ์ฆ์„œ๋ฅผ ์‚ฌ์šฉํ•œ๋‹ค. ์ธ์ฆ์„œ๋Š” ์‹ ๋ขฐํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๊ด€(Certificate Authority, CA)์— ์˜ํ•ด ๋ฐœ๊ธ‰๋˜๋ฉฐ, ์›น ์‚ฌ์ดํŠธ๊ฐ€ ๊ทธ ์ฃผ์žฅํ•˜๋Š” ๋ฐ”์™€ ๊ฐ™์€ ์‹ค์ œ ์กฐ์ง์— ์†ํ•ด ์žˆ์Œ์„ ๋ณด์ฆํ•œ๋‹ค.

๋ณด์•ˆ ๋ฐ ์‹ ๋ขฐ์„ฑ์˜ ์ฐจ์ด

HTTPS์˜ ์ฃผ์š” ์ด์ ์€ ๋ณด์•ˆ๊ณผ ์‹ ๋ขฐ์„ฑ์ด๋‹ค. ์‚ฌ์šฉ์ž๊ฐ€ ์›น์‚ฌ์ดํŠธ์— ๋กœ๊ทธ์ธ ์ •๋ณด๋‚˜ ์‹ ์šฉ์นด๋“œ ์ •๋ณด์™€ ๊ฐ™์€ ๋ฏผ๊ฐํ•œ ์ •๋ณด๋ฅผ ์ž…๋ ฅํ•  ๋•Œ, HTTPS๋Š” ์ด ์ •๋ณด๊ฐ€ ์•ˆ์ „ํ•˜๊ฒŒ ์„œ๋ฒ„์— ์ „์†ก๋˜๋„๋ก ๋ณด์žฅํ•œ๋‹ค. ๋˜ํ•œ, HTTPS๋Š” ์›น์‚ฌ์ดํŠธ๊ฐ€ ์‹ค์ œ๋กœ ์ฃผ์žฅํ•˜๋Š” ์กฐ์ง์— ์†ํ•ด ์žˆ์œผ๋ฉฐ ์ค‘๊ฐ„์ž ๊ณต๊ฒฉ์— ์˜ํ•ด ์œ„์žฅ๋œ ์‚ฌ์ดํŠธ๊ฐ€ ์•„๋‹˜์„ ์‚ฌ์šฉ์ž์—๊ฒŒ ๋ณด์ฆํ•œ๋‹ค.

๊ทธ๋ž˜์„œ https๋กœ ๋ฐ”๊พธ๋‹ˆ๊นŒ ๋ฐ”๋กœ ์ž˜๋จใ…Ž

profile
๐ŸŽ Apple Developer Academy@POSTECH 2๊ธฐ, ๐Ÿ€ SeSAC iOS 4๊ธฐ
post-custom-banner

1๊ฐœ์˜ ๋Œ“๊ธ€

comment-user-thumbnail
2024๋…„ 3์›” 17์ผ

์ž˜๋ณด๊ณ  ๊ฐ‘๋‹ˆ๋‹ค.!
info.plist๋ฅผ ์ด์šฉํ•ด ATS ์„ค์ •์œผ๋กœ ์‚ฌ์šฉํ•˜์‹œ๋Š” ๋„๋ฉ”์ธ ์˜ˆ์™ธ๋กœ ํ—ˆ์šฉํ•˜์‹œ๋ฉด httpํ†ต์‹ ๋„ ์ž˜๋˜์‹ค๊ฑฐ์˜ˆ์š” ๐Ÿซก

๋‹ต๊ธ€ ๋‹ฌ๊ธฐ