[ν’€μŠ€νƒ] HTTP request methods / Proxy Cache

2023. 4. 18. 17:48ㆍComputerScience/FullStackProgramming

 

 

 

Architectural Components of the Web

HTTP Networking

Proxy

  • HTTP intermediaries
  • Sit between clients and servers
  • Web Security
  • Application Integration
  • Performance Optimization

 

  • 초기 HTTP
    μ›Ή μ„œλ²„와 μ›Ή λΈŒλΌμš°μ € μ‚¬μ΄μ—
    쀑간에 λ­κ°€ μžˆλ‹€λŠ” μ•„이디어 X

 

  • ν΄λΌμ΄μ–ΈνŠΈμ™€ μ„œλ²„ μ‚¬μ΄
    ν΄λΌμ΄μ–ΈνŠΈμ˜ λ¦¬ν€˜μŠ€νŠΈκ°€ μ„œλ²„μ—κ²Œ μ§μ ‘ κ°€μ§€ μ•Šκ³ , 
    ν”„λ‘μ‹œλ₯Ό κ²½μœ ν•΄μ„œ μ„œλ²„μ—κ²Œ λ³΄λ‚Έλ‹€.
  • 사내 ν”„λ‘μ‹œ μ„œλ²„
    νšŒμ‚¬μ—μ„œ λ‚˜κ°€λŠ” νŠΈλž˜ν”½, λ“€μ–΄μ˜¬ λ•Œ μžˆλ‹€. 
    ν”„λ‘μ‹œ μ„œλ²„λ₯Ό κ²½μœ ν•΄μ•Ό ν•œλ‹€. 
  • web security
    νšŒμ‚¬ μ°¨μ›μ—μ„œ μ ‘속을 κΈˆμ§€ν•  μˆ˜ μžˆλ‹€ by proxy
    μ„œλ²„μ—μ„œ μ˜¨ κ°’에 λ°”μ΄λŸ¬μŠ€κ°€ μžˆλŠ”지 κ²€μ‚¬
  • application integration
    κ³ ν•΄μƒλ„μ˜ 4K μ΄λ―Έμ§€κ°€ λ‹€λ₯Έ κ΅­κ°€λ‘œ κ°ˆ λ•Œ, 
    μ €ν•΄μƒλ„λ‘œ ν”„λ‘μ‹œκ°€ λ³€ν™˜ 
  • Performance optimization
    PDF νŒŒμΌ λ“±λ“± νŒŒμΌ μ—„μ²­ λ§ŽμŒ (?) 
    -> ν”„λ‘μ‹œκ°€ μ‘닡을 μ£ΌλŠ” κ²ƒλ„ κ°€λŠ₯
    캐쉬 λ§ν•˜λŠ” κ±° μ•„λ‹κΉŒ? 
    • ν•œ 번 μ „μ†‘ν•œ λ°μ΄ν„°λŠ”, ν”„λ‘μ‹œ μ‹œμŠ€ν…œμ— μΊμ‰¬λ‘œ μ €μž₯ν•˜μ—¬ μ„±λŠ₯을 ν–₯상할 수 μžˆλ‹€. 
  • HTTP2 : ν”„λ‘μ‹œκ°€ μ „면에 λ“±μž₯
    https λΏλ§Œ μ•„λ‹ˆλΌ μ€‘κ°„ μ§€μ μ—μ„œ
    ν”„λ‘μ‹œκ°€ λ³΄μ•ˆμ„ ν•΄μ„œ, λ³΄μ•ˆλœ ν†΅λ‘œ λ§Œλ“€κΈ° κ°€λŠ₯ 
    톡신사가 μ„œλ²„μ—μ„œ λ°›λŠ” κ°’을 λ³Ό μˆ˜ μ—†μŒ

 

 

 

https://milestone-of-se.nesuke.com/en/nw-basic/grasp-nw/proxy/

 

 

 

HTTP Methods

Case study of each methods using example

 

1. GET

  • The most common method
  • Ask a server to send a resource
  • μ„œλ²„μ—κ²Œ resourceλ₯Ό 달라고 μš”μ²­ν•˜λŠ” λ©”μ†Œλ“œ

 

 

get method

 

 

 

https://www.cloud4y.ru/en/blog/what-are-http-requests/   URL(μœ„μΉ˜)을 톡해 μ›ν•˜λŠ” resourceλ₯Ό μ„œλ²„μ—κ²Œ μš”μ²­ν•˜λŠ” 것

 

 

 

2. HEAD 

  • The server returns only the headers in the response
  • A client to inspect the headers without having to get the resource
  • 본문을 μ œμ™Έν•œ, GETκ³Ό λ™μΌν•œ 응닡을 λ°›μŒ
  • GET ν•˜κΈ° μ „, κ·Έ 파일이 μ‹€μ‘΄ν•˜λŠ” 지 ν™•μΈν•˜κ³  싢을 λ•Œ
  • λ‚΄κ°€ 이미 κ·Έ νŒŒμΌμ„ κ°–κ³  μžˆλŠ”λ°, 
    μ—…λ°μ΄νŠΈ 된 λ‚΄μš©μ΄ μ—†λ‹€λ©΄, ꡳ이 λ°›μ•„μ˜¬ ν•„μš” X
    λ¦¬μ†ŒμŠ€μ˜ μ΅œμ’… λ³€κ²½ μ‹œκ°„λ„ 같이 μ˜¨λ‹€
    -> Last-Modified: ꡬ체적인 λ‚ μ§œ

 

 

 

3. PUT

  •  Writes documents to a server
  •  Many server require password before perform a PUT
  • λ¦¬μ†ŒμŠ€λ₯Ό μ„œλ²„μ— μ „λ‹¬ν•˜κ³ , μ €μž₯ν•˜μ‹œμ˜€

 

 

 

4. POST

  • Send input data to the server
  • μ„œλ²„μ— μž…λ ₯을 λ³΄λ‚Έλ‹€ 
    이 κ°’에 μ˜ν•΄ μ„œλ²„μ—μ„œ 둜직이 λˆλ‹€
    둜직 κ³„μ‚° κ²°κ³Όλ₯Ό μ‘λ‹΅ν•΄μ€€λ‹€. 
  • PUTκ³Ό λ‹¬λ¦¬ μ†ŒλŸ‰μ˜ μ •λ³΄λ“€μ„ μž…λ ₯
  • ν•¨μˆ˜μ˜ μž…λ ₯ νŒŒλΌλ―Έν„°
  • GET - URL에 집어 λ„£κ³  κ·Έλƒ₯ κ°–κ³  μ˜€λŠ” 것  vs  
    POST - input parameterλ₯Ό 톡해 dynamicν•˜κ²Œ κ°–κ³  μ˜€λŠ” 것
    어라 ? 이게 μ•„λ‹Œ 것 κ°™λ‹€

 

 

 

https://m.blog.naver.com/kanesbg/10180605884

 

 

 

  • GET 방식 - μ—½μ„œ 방식
    • λ³Έλ¬Έ λ‚΄μš©μ— λ…ΈμΆœλ˜κΈ° λ•Œλ¬Έμ— λ³΄μ•ˆ 상 μ·¨μ•½
    • 데이터λ₯Ό URL에 전달
    • '?' μ‚¬μš© -> GET
    • 결제, 인증 λ“± μ€‘μš”ν•œ λ‚΄μš© μž‘μ„± μ‹œ X
  • POST방식 - νŽΈμ§€ λ΄‰νˆ¬ 방식
    • μ€‘μš” μˆ˜λ‹¨ 결제, 인증 λ“±μ˜ μž‘μ—…
    • λ©”μ‹œμ§€ 본문에 λ„£μ–΄μ„œ 전달
    • dataκ°€ request bodyλ₯Ό 톡해 전솑됨
    • PUTκ³Ό GET의 쀑간 지점 ?

 

 

 

5. TRACE

  •  Clients to see how TRACE request looks when it finally makes it to the server
  • λ„ˆμ™€ λ‚˜ μ‚¬μ΄μ— ν”„λ‘μ‹œκ°€ μžˆμ„κΉŒ?
    ν”„λ‘μ‹œκ°€ via field μΆ”κ°€
    μ„œλ²„λŠ” μ΄λŸ¬ν•œ ν”„λ‘μ‹œμ˜ μ •λ³΄λ₯Ό ν†΅μœΌλ‘œ λ³Έλ¬ΈμœΌλ‘œ λŒλ €μ€Œ
  • λ‚΄κ°€ κ°€μ§€κ³  μžˆλŠ” λ„€νŠΈμ›Œν¬μ—μ„œ
    λ‚΄κ°€ λ³΄λ‚Έ μ •λ³΄κ°€ μ˜€λ™μž‘ν•œλ‹€
    -> 디버깅 λͺ©μ μœΌλ‘œ μ‚¬μš© κ°€λŠ₯
  • KT, SKT 톡신사 ν˜Ήμ€ νšŒμ‚¬ ν”„λ‘μ‹œ 
    이런 λͺ…령에 μ‘λ‹΅ν•˜μ§€λŠ” μ•ŠλŠ”λ‹€.

 

 

 

κ°€μš΄λ° Via - proxy3. ~~~

 

 

 

6. OPTIONS

  • Asks the server to tell us about the various supported capabilities of the web server
  • μ„œλ²„κ°€ μ§€μ›ν•˜λŠ” κΈ°λŠ₯에 λŒ€ν•˜μ—¬ λ¬»λŠ” 것
  • λͺ¨λ“  κΈ°λŠ₯을 μ§€μ›ν•˜μ§€λŠ” μ•Šμ„ 수 μžˆλ‹€.

 

 

 

ν™œμš© κ°€λŠ₯ν•œ option에 λŒ€ν•΄ μ•Œλ €μ€€λ‹€ (μ‘λ‹΅ν•œλ‹€)

 

 

 

Status Codes

Execution results to a client
-> μ‹€ν–‰ κ²°κ³Όλ₯Ό ν΄λΌμ΄μ–ΈνŠΈμ—κ²Œ μ•Œλ €μ£ΌλŠ” 것 

 

  • Redirected request to new location
    • ex) 응닡 μ½”λ“œ 301 
    • 1) μ›ν•˜λŠ” μ •λ³΄λŠ” λ‚˜μ—κ²Œ μ—†μœΌλ‹ˆ λ‹€λ₯Έ κ³³μœΌλ‘œ κ°€ 
    • 2) 문지기 μ„œλ²„κ°€ ν΄λΌμ΄μ–ΈνŠΈμ˜ λ¦¬ν€˜μŠ€νŠΈλŠ” λ‹€ λ°›κ³ ,
      본인이 μ ν•©ν•œ μ„œλ²„λ‘œ μ „달할 λ•Œ (둜그인 μˆ™μˆ™μˆ™)
    • 둜그인 ν•˜λŠ” μ„œλ²„인데, μ‹€μ œ μ ‘μ†ν•˜λŠ” κ³³μ€ λ‹€λ₯Έ κ²½μš°

 

  •  Request redirected to use local copy (μΊμ‹œ κ΄€λ ¨)
    • HEAD λ©”μ†Œλ“œλ₯Ό ν†΅ν•œ κ΅¬ν˜„ 
    • get method λ‚΄λΆ€, if modified since 
    • 이 μ‹œμ  μ΄ν›„에 μˆ˜μ •λ˜μ—ˆμ„ λ•Œλ§Œ λ‚˜μ—κ²Œ λ³΄λ‚΄μ€˜

    • 304 not modified 
      μ›Ή λΈŒλΌμš°μ €λŠ” μΊμ‰¬μ—μ„œ κΊΌλ‚΄μ„œ λ³΄λ‚΄μ€€λ‹€. 
      이게 μΊμ‰¬μ˜ μ •μ²΄ !
    • μž₯점: μ„±λŠ₯ ν–₯상 
    • 단점: μš©λŸ‰ λΆ€ν•˜ + μ†λ„ 느렀질 수 있음