A source,



When I read the RFC documentation, I saw the word hop-by-hop, and I was a little confused, so I dug up its relevant meaning.

Second, the meaning

I’m going to hop by hop. I’m going to hop by hop. End-to-end is end-to-end. Both of these are HTTP header fields.

1, the meaning of the original

13.5.1 End-to-end and Hop-by-hop Headers


For the purpose of defining the behavior of caches and non-caching proxies, we divide HTTP headers into two categories:


End-to-end headers, which must be transmitted to the ultimate recipient of a request or response. End-to-end headers in responses must be stored as part of a cache entry and transmitted in any response formed from a cache entry.


Hop-by-hop headers, which are meaningful only for a single transport-level connection, and are not stored by caches or forwarded by proxies.


The following HTTP/1.1 headers are hop-by-hop headers:


Connection


Keep-Alive


Public


Proxy-Authenticate


Transfer-Encoding


Upgrade


All other headers defined by HTTP/1.1 are end-to-end headers.


Hop-by-hop headers introduced in future versions of HTTP MUST be listed in a Connection header, as described in section 14.10.


Source:
https://www.freesoft.org/CIE/…

13.5.1 End-to-end and hop-by-hop headers

To define the behavior of cached and non-cached proxies, we divide HTTP headers into two categories: End-to-End Headers, which must be delivered to the ultimate recipient of the request or response. The end-to-end headers in the response must be stored as part of the cached entry and transmitted in any response formed from the cached entry. Hop-by- Hop headers, which make sense only for a single transport-level connection, are not stored in a cache or forwarded by a proxy. The following HTTP/1.1 headers are hop-by-hop headers: All other headers defined by Connection Keep-Alive Public Proxy-Authenticate Transfer-Encoding Upgrade HTTP/1.1 are end-to-end headers. As described in Section 14.10 (p. 514), hop-by-hop headers that will be introduced in future versions of HTTP must be listed in the connection header.

The difference between HTTP connection and TCP connection

An HTTP connection back and forth can include multiple terminals. For example, a request made by a browser goes first to nginx on the server host and then to nginx on the docker container (the real Web server). The end-to-end header is forwarded by the proxy in the middle. For example, the host field in the request header is normally passed to the container’s nginx intact. The hop-by-bop header is only valid for the current TCP connection. This only takes effect between the browser and the host nginx. If the host and container nginx are not set, it will not take effect. Connection: keep-alive is a long connection between the browser and the host nginx, but it is not a long connection between the host nginx and the container nginx.

Reference link:


https://datatracker.ietf.org/…


https://cloud.tencent.com/dev…