[TIL] HTTP : The Definitive Guide "p155 ~ p157"

시윤·2024년 4월 19일
0

[TIL] Two Pages Per Day

목록 보기
66/109
post-thumbnail

Chapter 6. Proxies

(해석 또는 이해가 잘못된 부분이 있다면 댓글로 편하게 알려주세요.)


❤️ 원문 번역 ❤️

The TRACE Method

Proxy servers can change messages as the messages are forwarded. Headers are added, modified, and removed, and bodies can be converted to different formats. As proxies become more sophisticated, and more vendors deploy proxy products, interoperability problems increase. To easily diagnose proxy networks, we need a way to conveniently watch how messages change as they are forwarded, hop by hop, through the HTTP proxy network.

  • 프록시 서버는 메시지를 포워딩할 때 메시지를 수정할 수 있습니다.

  • 헤더가 추가되고, 수정되고, 삭제되며 본문은 다른 형태로 변환될 수 있습니다.

  • 프록시가 더 정교해지고 더 많은 공급자가 프록시 상품을 배포함에 따라 상호운용 문제가 증가하게 되었습니다.

  • 프록시 네트워크를 쉽게 진단하기 위해서는 메시지가 HTTP 프록시 네트워크를 통해 hop by hop으로 포워딩 될 때 어떻게 변화하는지 편리하게 감시할 수 있는 수단이 필요합니다.

HTTP/1.1’s TRACE method lets you trace a request message through a chain of proxies, observing what proxies the message passes through and how each proxy modifies the request message. TRACE is very useful for debugging proxy flows.*

  • HTTP/1.1의 TRACE 메소드는 프록시 체인을 통과하는 요청 메시지를 추적할 수 있게 합니다. TRAE 메소드는 어떤 프록시가 메시지를 전달하며, 어떻게 각각의 프록시가 요청 메시지를 수정하는지 관찰하는 역할을 합니다.

  • TRACE는 프록시의 흐름을 디버깅하는 데 매우 유용합니다.

When the TRACE request reaches the destination server,† the entire request message is reflected back to the sender, bundled up in the body of an HTTP response (see Figure 6-23). When the TRACE response arrives, the client can examine the exact message the server received and the list of proxies through which it passed (in the Via header). The TRACE response has Content-Type message/http and a 200 OK status.

  • TRACE 요청이 목적 서버에 도달하면 전체 요청 메시지가 HTTP 응답 메시지의 본문에 포함되어 발신자에게 다시 반환됩니다. (Figure 6-23)

  • TRACE 응답이 도착하면 클라이언트는 서버가 받은 정확한 메시지와 통과한 프록시의 목록을 (Via 헤더를 통해) 확인할 수 있습니다.

  • TRACE 응답은 Content-Type: message/http와 200 OK 상태 코드를 가지고 있습니다.

Max-Forwards

Normally, TRACE messages travel all the way to the destination server, regardless of the number of intervening proxies. You can use the Max-Forwards header to limit the number of proxy hops for TRACE and OPTIONS requests, which is useful for testing a chain of proxies forwarding messages in an infinite loop or for checking the effects of particular proxy servers in the middle of a chain. Max-Forwards also limits the forwarding of OPTIONS messages (see “Proxy Interoperation”).

  • 일반적으로 TRACE 메시지는 개입하는 프록시의 개수에 관계없이 목적 서버로 이동합니다.

  • Max-Forwards 헤더를 사용하면 TRACE와 OPTIONS 요청에 대한 프록시 홉의 개수를 제한하여 무한 루프로 메시지를 포워딩하는 프록시 체인을 테스트하거나 체인 중간에 위치한 특정 프록시 서버의 영향을 확인하기 좋습니다.

  • 또한 Max-Forwards는 OPTIONS 메시지를 포워딩하는 것을 제한합니다. ("Proxy Interoperation" - 다음 포스팅 참고)

The Max-Forwards request header field contains a single integer indicating the remaining number of times this request message may be forwarded (Figure 6-24). If the Max-Forwards value is zero (Max-Forwards: 0), the receiver must reflect the TRACE message back toward the client without forwarding it further, even if the receiver is not the origin server.

  • Max-Forwards 요청 헤더 필드는 해당 요청 메시지를 포워딩할 수 있는 남은 횟수를 나타내는 하나의 정수를 포함합니다. (Figure 6-24)

  • 만약 Max-Forwards 값이 0이라면(Max-Forwards: 0), 수신단이 origin 서버가 아니라고 하더라도 TRACE 메시지를 더 이상 포워딩하지 않고 클라이언트로 반환해야 합니다.

If the received Max-Forwards value is greater than zero, the forwarded message must contain an updated Max-Forwards field with a value decremented by one. All proxies and gateways should support Max-Forwards. You can use Max-Forwards to view the request at any hop in a proxy chain.

  • 만약 Max-Forwards의 값이 0보다 크다면, 포워딩되는 메시지는 값이 1만큼 감소하도록 업데이트된 Max-Forwards 필드를 포함해야 합니다.

  • 모든 프록시와 게이트웨이는 Max-Forwards를 지원해야 합니다.

  • Max-Forwards를 사용하면 프록시 체인에 존재하는 임의의 hop에 위치한 요청을 확인할 수 있습니다.


Proxy Authentication

Proxies can serve as access-control devices. HTTP defines a mechanism called proxy authentication that blocks requests for content until the user provides valid access- permission credentials to the proxy:

  • 프록시는 액세스 컨트롤 서비스를 제공할 수 있습니다.

  • HTTP는 '프록시 인증'이라고 불리는 매커니즘을 정의합니다. 프록시 인증은 유저가 유효한 접근 허용 자격 증명을 프록시에 전달하기 전까지 콘텐츠에 대한 요청을 차단합니다.

  • When a request for restricted content arrives at a proxy server, the proxy server can return a 407 Proxy Authorization Required status code demanding access credentials, accompanied by a Proxy-Authenticate header field that describes how to provide those credentials (Figure 6-25b).
  • 제한된 콘텐츠에 대한 요청이 프록시 서버에 도착하면 프록시 서버는 access 자격 증명을 요구하는 407 Proxy Authorization Required 상태 코드와 해당 자격 증명을 제공하는 방법을 나타내는 Proxy-Authenticate 헤더 필드를 반환할 수 있습니다. (Figure 6-25b)
  • When the client receives the 407 response, it attempts to gather the required credentials, either from a local database or by prompting the user.
  • 클라이언트는 407 응답을 받으면 로컬 데이터베이스나 유저의 프롬프팅을 통해 요구되는 자격 증명을 모으기 위해 시도합니다.
  • Once the credentials are obtained, the client resends the request, providing the required credentials in a Proxy-Authorization header field.
  • 자격 증명이 포함이 포함되면, 클라이언트는 요청을 재전송하여 Proxy-Authorization 헤더 필드를 통해 요구받은 자격 증명을 제공합니다.
  • If the credentials are valid, the proxy passes the original request along the chain (Figure 6-25c); otherwise, another 407 reply is sent.
  • 만약 자격 증명이 유효하다면 원본 요청을 체인을 따라 전송합니다. (Figure 6-25c)

  • 그렇지 않다면 407 응답을 전송합니다.

Proxy authentication generally does not work well when there are multiple proxies in a chain, each participating in authentication. People have proposed enhancements to HTTP to associate authentication credentials with particular waypoints in a proxy chain, but those enhancements have not been widely implemented.

  • 프록시 인증 방식은 일반적으로 체인에 인증에 참여하는 각각의 프록시가 여러 개 존재할 때 잘 작동하지 않습니다.

  • 사람들은 인증 자격 증명을 프록시 체인의 특정 경유지와 연결하기 위해 HTTP를 향상시킬 것을 제안했습니다. 그러나 이러한 개선사항은 아직까지 널리 구현되지 않았습니다.

Be sure to read Chapter 12 for a detailed explanation of HTTP’s authentication mechanisms.

  • HTTP의 인증 매커니즘에 대한 자세한 설명은 Chapter 12를 참고하시기 바랍니다.


🧡 요약 정리 🧡

The TRACE Method

: 프록시는 메시지 포워딩 시 메시지 수정 가능 -> 메시지가 hop by hop으로 포워딩 될 때 변화 과정 추적

  • TRACE 요청이 목적 서버에 도달하면 전체 요청 메시지가 응답 본문에 포함
  • 응답이 도착하면 서버가 받은 메시지와 통과한 프록시 목록(Via 헤더) 확인 가능

Max-Forwards

: 요청 메시지를 포워딩할 수 있는 남은 횟수를 나타내는 정수

  • Max-Forwards: 0이면 더 이상 포워딩하지 않고 클라이언트로 반환
  • Max-Forwards 값이 0 이상이면 다음 홉으로 포워딩하고 1만큼 감소
  • 무한 루프로 메시지를 포워딩하는 프록시 체인 테스트
  • 체인 중간에 위치한 임의의 프록시 서버(hop)가 미치는 영향 확인

Proxy Authentication

: 유저가 접근 자격 증명을 프록시에 전달하기 전까지 콘텐츠에 대한 요청을 차단하는 것

  • 407 Proxy Authorization Required : 접근 자격 증명 요구
  • Proxy-Authenticate : 접근 자격 증명 방법을 명시하는 프록시의 응답 헤더
  • Proxy-Authorization : 클라이언트가 프록시에 제공하는 접근 자격 증명

💛 감상 💛

  • 예전에 상태 코드를 배울 때는 잘 와닿지 않았던 407 상태 코드를 명확하게 이해할 수 있었습니다. 프록시에서 Authentication을 할 때, 프록시 서버가 Proxy-Authenticate에 포함한 자격 증명 방식을 토대로 클라이언트가 Proxy-Authorization를 포함한 요청을 전송하는 매커니즘을 이해하게 되었습니다.

  • 목적 서버가 아닌 체인 중간에 위치한 프록시 서버를 확인하기 위해서는 Max-Forwards 헤더를 포함하여 TRACE 요청을 전송할 수 있다는 것을 알게 되었습니다.

profile
맑은 눈의 다람쥐

0개의 댓글

관련 채용 정보