English
Forward Proxy vs Reverse Proxy: Connection Paths, Trust Boundaries, and Latency
In modern hyperscale web architectures, a proxy is no longer a simple passthrough daemon. It constitutes the absolute cryptographic and isolation boundary governing trust, security, and extreme-percentile performance. An explicit corporate forward proxy masks client identity and enforces outbound Zero-Trust policies. Conversely, an edge reverse proxy (e.g., API gateways, Envoy, Nginx) absorbs massive ingress floods, terminates TLS, enforces rate-limiting via shared memory, and prevents layer-7 volumetric attacks.
Misconfigurations at these boundaries lead to catastrophic vulnerabilities: HTTP Request Smuggling (TE.CL/CL.TE), IP spoofing, and lateral movement privilege escalations. In this deeply technical guide, we deconstruct the HTTP intermediary model using C++ source code analysis, implement SPIFFE/SPIRE identity planes, and utilize eBPF for microsecond-level latency profiling.
1. Beyond Basic Topologies: Transparent Interception and Sidecars
The traditional definitions of forward and reverse proxies fail to capture modern Service Mesh topologies (e.g., Istio, Linkerd) and eBPF-accelerated networking (e.g., Cilium).
- Envoy Sidecar (Transparent Reverse & Forward): In a mesh, an Envoy sidecar intercepts all inbound and outbound pod traffic using
iptablesor eBPFsockmapredirection. It acts as a reverse proxy to the local application and a forward proxy to remote services, handling mTLS encapsulation. - Transparent eBPF Redirection: Instead of TCP/IP stack traversal, modern proxies bypass the kernel networking stack. BPF programs attached to
cgroup/skborsockopscan directly forward socket buffers (SKBs) between the proxy and application, reducing memory copies from $O(N)$ to $O(1)$.
Visualizing Cryptographic Trust Boundaries
graph TD
subgraph Edge Network
CDN[Edge CDN / WAF]
end
subgraph Kubernetes Cluster
IG[Ingress Gateway (Envoy)]
subgraph Pod A
SA[Sidecar Proxy]
AppA[Microservice A]
end
subgraph Pod B
SB[Sidecar Proxy]
AppB[Microservice B]
end
end
SPIRE[SPIRE Server]
CDN -->|Internet TLS| IG
IG -->|mTLS via SPIFFE ID| SA
SA -->|Localhost / sockmap| AppA
SA -->|mTLS via SPIFFE ID| SB
SB -->|Localhost| AppB
SPIRE -.->|Issues Short-lived SVIDs| IG
SPIRE -.->|Issues Short-lived SVIDs| SA
SPIRE -.->|Issues Short-lived SVIDs| SB
classDef trust fill:#d4edda,stroke:#28a745,stroke-width:2px;
class SA,SB,AppA,AppB,IG,SPIRE trust;
2. Source Code Analysis: The X-Forwarded-For Vulnerability in C++
Trust boundaries are broken when untrusted IP headers are evaluated for authentication or rate limiting. Let's examine how enterprise proxies like Envoy handle this defensively in C++ within ConnectionManagerImpl.
If you blindly parse the first IP in X-Forwarded-For (XFF), a malicious payload like X-Forwarded-For: 127.0.0.1, 203.0.113.50 easily bypasses naive IP blocklists.
// Envoy's approach to determining the trusted client IP
// Source: envoy/source/common/http/conn_manager_utility.cc
void ConnectionManagerUtility::mutateRequestHeaders(
Http::RequestHeaderMap& headers, Network::Connection& connection,
const envoy::config::core::v3::HttpConnectionManager& config,
const LocalInfo::LocalInfo& local_info) {
// Determine the true remote address based on configured trusted hops
uint32_t xff_num_trusted_hops = config.xff_num_trusted_hops();
// Envoy securely iterates backwards through the XFF header list
// skipping exactly `xff_num_trusted_hops` to find the true client IP.
auto xff_address = utility::getLastAddressFromXFF(headers, xff_num_trusted_hops);
if (xff_address != nullptr) {
// Overwrite the remote address with the validated XFF IP
connection.connectionInfoSetter().setRemoteAddress(xff_address);
}
}
The Mathematical Invariant: Let $H = [IP_1, IP_2, ..., IP_n]$ be the list of IPs in XFF. If your infrastructure has $K$ layers of trusted reverse proxies, the true client IP is always at index $n - K$. Any IP at index $i < n - K$ must be treated as hostile injected payload.
3. SPIFFE/SPIRE: Mathematical Identity Verification (Zero-Trust)
Relying on network topography (VPC isolation, IP whitelisting) is an anti-pattern. Modern architectures utilize SPIFFE (Secure Production Identity Framework for Everyone) to cryptographically attest identity. Instead of "Is this connection from the reverse proxy IP?", the question is "Does this connection hold a valid X.509 SVID signed by our root CA?"
The probability of a forged identity under SPIFFE is constrained by the Discrete Logarithm Problem (for ECDSA) or integer factorization (RSA). For an attacker to forge an SVID, they must solve the ECDSA signature equation $s = k^{-1} (z + r d_A) pmod n$, which takes $O(sqrt{n})$ time using Pollard's rho algorithm, computationally infeasible for 256-bit curves ($2^{128}$ operations).
4. eBPF: Microsecond-Level Boundary Profiling
To measure the true cost of traversing a proxy boundary, we discard userspace curl scripts and use eBPF (Extended Berkeley Packet Filter). By hooking into kernel TCP state transitions, we can trace the exact latency of the socket backlog and proxy memory allocation.
// eBPF kprobe tracing proxy accept() latency
#include <linux/bpf.h>
#include <linux/tcp.h>
BPF_HASH(start_time, u32, u64);
int kprobe__tcp_v4_conn_request(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
u32 pid = bpf_get_current_pid_tgid();
u64 ts = bpf_ktime_get_ns();
start_time.update(&pid, &ts);
return 0;
}
int kretprobe__tcp_v4_conn_request(struct pt_regs *ctx) {
u32 pid = bpf_get_current_pid_tgid();
u64 *tsp = start_time.lookup(&pid);
if (tsp != 0) {
u64 delta_us = (bpf_ktime_get_ns() - *tsp) / 1000;
bpf_trace_printk("Proxy SYN-ACK latency: %d us\n", delta_us);
start_time.delete(&pid);
}
return 0;
}
Running this BCC/eBPF script allows engineers to detect kernel-level SYN-flooding or socket lock contention before it manifests as Application Layer (L7) HTTP 504 errors.
5. Mathematical Modeling of Proxy Latency and Queuing
Let's formalize the latency introduced by a proxy. Rather than a deterministic addition, it follows an $M/M/1$ or $M/D/1$ queuing model. The expected waiting time $W_q$ in the proxy's event loop is given by Pollaczek-Khinchine formula:
$$ W_q = frac{lambda mathbb{E}[S^2]}{2(1 - rho)} $$
Where $lambda$ is the arrival rate, $rho = lambda mu^{-1}$ is the utilization factor, and $mathbb{E}[S^2]$ is the second moment of service time. A proxy TLS handshake involves RSA/ECDSA operations with high variance. As $rho to 1$, $W_q$ diverges to infinity. This proves mathematically why reverse proxies must shed load (circuit breaking) rather than queueing indefinitely when backend services degrade.
Engineering Trust-Boundary Checklist
- Cryptographic Identity over IP: Implement SPIFFE/mTLS between reverse proxies and upstream services. Never rely purely on network segments.
- eBPF Socket Acceleration: Deploy Cilium or
sockmapto bypass TCP/IP overhead for sidecar/proxy IPC. - X-Forwarded-For Sanitization: Explicitly configure
xff_num_trusted_hopsin Envoy orset_real_ip_fromin Nginx. Drop invalid packets at the edge. - Latency Distributions: Measure proxy latency via eBPF histograms, observing the 99.9th percentile ($P_{99.9}$).
References
Chinese
正向代理与反向代理原理:连接路径、信任边界和时延计算
Open as a full page在现代超大规模的Web架构中,代理早已不再是一个简单的直通守护进程。它构成了管理信任、安全和极端分位延迟的绝对密码学与隔离边界。显式的企业正向代理(Forward Proxy)掩盖了客户端的身份,并执行出站的零信任(Zero-Trust)策略。相反,边缘反向代理(Reverse Proxy)(例如 API 网关、Envoy、Nginx)负责吸收海量的入站流量、终止 TLS、通过共享内存执行限流,并防御应用层(L7)的容量耗尽攻击。
这些边界处的配置失误往往会导致灾难性的漏洞:HTTP 请求走私(TE.CL/CL.TE)、IP 欺骗以及横向移动权限提升。在这份极具深度的技术指南中,我们将通过 C++ 源码分析解构 HTTP 中介模型,实施 SPIFFE/SPIRE 身份平面,并利用 eBPF 进行微秒级的延迟分析。
1. 超越基础拓扑:透明拦截与 Sidecar 模式
传统意义上的正向和反向代理定义,已经无法准确描述现代服务网格(Service Mesh,如 Istio, Linkerd)拓扑以及基于 eBPF 加速的网络架构(如 Cilium)。
- Envoy Sidecar(透明的正向与反向代理): 在服务网格中,Envoy sidecar 通过
iptables或 eBPF 的sockmap重定向来拦截所有入站和出站的 Pod 流量。它对本地应用来说是反向代理,对远程服务来说又是正向代理,负责处理 mTLS 封装。 - eBPF 透明重定向: 现代代理不再遍历整个 TCP/IP 协议栈,而是完全绕过内核网络栈。附加到
cgroup/skb或sockops的 BPF 程序可以在代理和应用之间直接转发套接字缓冲区(SKB),将内存拷贝的复杂度从 $O(N)$ 降低到 $O(1)$。
可视化密码学信任边界
graph TD
subgraph Edge Network [边缘网络]
CDN[边缘 CDN / WAF]
end
subgraph Kubernetes Cluster [Kubernetes 集群]
IG[Ingress Gateway (Envoy)]
subgraph Pod A
SA[Sidecar 代理]
AppA[微服务 A]
end
subgraph Pod B
SB[Sidecar 代理]
AppB[微服务 B]
end
end
SPIRE[SPIRE 身份服务器]
CDN -->|互联网 TLS| IG
IG -->|基于 SPIFFE ID 的 mTLS| SA
SA -->|Localhost / sockmap| AppA
SA -->|基于 SPIFFE ID 的 mTLS| SB
SB -->|Localhost| AppB
SPIRE -.->|签发短生命周期 SVID| IG
SPIRE -.->|签发短生命周期 SVID| SA
SPIRE -.->|签发短生命周期 SVID| SB
classDef trust fill:#d4edda,stroke:#28a745,stroke-width:2px;
class SA,SB,AppA,AppB,IG,SPIRE trust;
2. 源码分析:C++ 中 X-Forwarded-For 的脆弱性
当仅仅依据不受信任的 IP 标头来进行身份验证或限流时,信任边界就被打破了。让我们来看看企业级代理(如 Envoy)是如何在 C++ 的 ConnectionManagerImpl 模块中进行防御性处理的。
如果你盲目地解析 X-Forwarded-For (XFF) 标头中的第一个 IP,恶意攻击者只需发送类似 X-Forwarded-For: 127.0.0.1, 203.0.113.50 的请求,即可轻松绕过基于 IP 的黑名单防御机制。
// Envoy 确定受信任客户端 IP 的核心逻辑
// 源码路径: envoy/source/common/http/conn_manager_utility.cc
void ConnectionManagerUtility::mutateRequestHeaders(
Http::RequestHeaderMap& headers, Network::Connection& connection,
const envoy::config::core::v3::HttpConnectionManager& config,
const LocalInfo::LocalInfo& local_info) {
// 基于配置的受信任跳数,确定真实的远程地址
uint32_t xff_num_trusted_hops = config.xff_num_trusted_hops();
// Envoy 从右向左安全地遍历 XFF 标头列表
// 严格跳过 `xff_num_trusted_hops` 次,以找到真实的客户端 IP。
auto xff_address = utility::getLastAddressFromXFF(headers, xff_num_trusted_hops);
if (xff_address != nullptr) {
// 使用验证后的 XFF IP 覆盖原始的 Remote Address
connection.connectionInfoSetter().setRemoteAddress(xff_address);
}
}
数学不变式: 假设 $H = [IP_1, IP_2, ..., IP_n]$ 是 XFF 中的 IP 列表。如果你的基础设施拥有 $K$ 层受信任的反向代理,那么真实的客户端 IP 永远位于索引 $n - K$ 处。任何位于索引 $i < n - K$ 处的 IP 都必须被视为恶意的注入负载。
3. SPIFFE/SPIRE:数学层面的身份验证(零信任架构)
依赖网络拓扑(VPC 隔离、IP 白名单)是一种反模式。现代架构利用 SPIFFE(面向所有人的安全生产身份框架)在密码学层面证明身份。验证逻辑不再是“这个连接是否来自反向代理的 IP?”,而是变成了“这个连接是否持有我们根 CA 签发的有效 X.509 SVID 证书?”
在 SPIFFE 框架下,伪造身份的概率受到离散对数问题(针对 ECDSA)或整数分解难题(针对 RSA)的严格约束。攻击者要伪造一个 SVID,必须求解 ECDSA 签名方程 $s = k^{-1} (z + r d_A) pmod n$。即使使用 Pollard's rho 算法,时间复杂度也高达 $O(sqrt{n})$,对于 256 位椭圆曲线而言($2^{128}$ 次运算),在计算上是绝对不可行的。
4. eBPF:微秒级边界性能剖析
为了衡量穿透代理边界的真实代价,我们必须抛弃用户态的 curl 脚本,转而使用 eBPF (Extended Berkeley Packet Filter)。通过 Hook 内核 TCP 状态转换,我们可以追踪套接字积压(backlog)和代理内存分配的确切延迟。
// eBPF kprobe: 追踪代理 accept() 的微秒级延迟
#include <linux/bpf.h>
#include <linux/tcp.h>
BPF_HASH(start_time, u32, u64);
int kprobe__tcp_v4_conn_request(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
u32 pid = bpf_get_current_pid_tgid();
u64 ts = bpf_ktime_get_ns();
start_time.update(&pid, &ts);
return 0;
}
int kretprobe__tcp_v4_conn_request(struct pt_regs *ctx) {
u32 pid = bpf_get_current_pid_tgid();
u64 *tsp = start_time.lookup(&pid);
if (tsp != 0) {
u64 delta_us = (bpf_ktime_get_ns() - *tsp) / 1000;
bpf_trace_printk("Proxy SYN-ACK latency: %d us\n", delta_us);
start_time.delete(&pid);
}
return 0;
}
运行这段 BCC/eBPF 脚本使工程师能够在内核级别的 SYN-flood 或套接字锁争用演变成应用层(L7)的 HTTP 504 错误之前,将其精准捕获。
5. 代理延迟与排队论的数学建模
让我们将代理引入的延迟形式化。它并非一个确定性的常数,而是遵循 $M/M/1$ 或 $M/D/1$ 排队模型。代理事件循环中的期望等待时间 $W_q$ 可由 Pollaczek-Khinchine 公式给出:
$$ W_q = frac{lambda mathbb{E}[S^2]}{2(1 - rho)} $$
其中 $lambda$ 是到达率,$rho = lambda mu^{-1}$ 是利用率因子,$mathbb{E}[S^2]$ 是服务时间的二阶矩。代理的 TLS 握手涉及高方差的 RSA/ECDSA 计算。当 $rho to 1$ 时,$W_q$ 发散到无穷大。这在数学上证明了,当后端服务降级时,反向代理必须主动丢弃负载(熔断器机制),而不是无限期地排队。
生产环境信任边界检查清单
- 用密码学身份取代 IP: 在反向代理和上游服务之间全面实施 SPIFFE/mTLS。绝不能仅仅依赖网络微分段。
- eBPF 套接字加速: 部署 Cilium 或配置
sockmap,消除 Sidecar/Proxy IPC 的 TCP/IP 协议栈开销。 - X-Forwarded-For 消毒: 必须在 Envoy 中显式配置
xff_num_trusted_hops,或在 Nginx 中配置set_real_ip_from,并在边缘节点直接丢弃非法数据包。 - 延迟分布追踪: 使用 eBPF 直方图(histograms)测量代理内部延迟,密切关注 P99.9 分位数。
参考资料
In modern hyperscale web architectures, a proxy is no longer a simple passthrough daemon. It constitutes the absolute cryptographic and isolation boundary governing trust, security, and extreme-percentile performance. An explicit corporate forward proxy masks client identity and enforces outbound Zero-Trust policies. Conversely, an edge reverse proxy (e.g., API gateways, Envoy, Nginx) absorbs massive ingress floods, terminates TLS, enforces rate-limiting via shared memory, and prevents layer-7 volumetric attacks.
Misconfigurations at these boundaries lead to catastrophic vulnerabilities: HTTP Request Smuggling (TE.CL/CL.TE), IP spoofing, and lateral movement privilege escalations. In this deeply technical guide, we deconstruct the HTTP intermediary model using C++ source code analysis, implement SPIFFE/SPIRE identity planes, and utilize eBPF for microsecond-level latency profiling.
1. Beyond Basic Topologies: Transparent Interception and Sidecars
The traditional definitions of forward and reverse proxies fail to capture modern Service Mesh topologies (e.g., Istio, Linkerd) and eBPF-accelerated networking (e.g., Cilium).
- Envoy Sidecar (Transparent Reverse & Forward): In a mesh, an Envoy sidecar intercepts all inbound and outbound pod traffic using
iptablesor eBPFsockmapredirection. It acts as a reverse proxy to the local application and a forward proxy to remote services, handling mTLS encapsulation. - Transparent eBPF Redirection: Instead of TCP/IP stack traversal, modern proxies bypass the kernel networking stack. BPF programs attached to
cgroup/skborsockopscan directly forward socket buffers (SKBs) between the proxy and application, reducing memory copies from $O(N)$ to $O(1)$.
Visualizing Cryptographic Trust Boundaries
graph TD
subgraph Edge Network
CDN[Edge CDN / WAF]
end
subgraph Kubernetes Cluster
IG[Ingress Gateway (Envoy)]
subgraph Pod A
SA[Sidecar Proxy]
AppA[Microservice A]
end
subgraph Pod B
SB[Sidecar Proxy]
AppB[Microservice B]
end
end
SPIRE[SPIRE Server]
CDN -->|Internet TLS| IG
IG -->|mTLS via SPIFFE ID| SA
SA -->|Localhost / sockmap| AppA
SA -->|mTLS via SPIFFE ID| SB
SB -->|Localhost| AppB
SPIRE -.->|Issues Short-lived SVIDs| IG
SPIRE -.->|Issues Short-lived SVIDs| SA
SPIRE -.->|Issues Short-lived SVIDs| SB
classDef trust fill:#d4edda,stroke:#28a745,stroke-width:2px;
class SA,SB,AppA,AppB,IG,SPIRE trust;
2. Source Code Analysis: The X-Forwarded-For Vulnerability in C++
Trust boundaries are broken when untrusted IP headers are evaluated for authentication or rate limiting. Let’s examine how enterprise proxies like Envoy handle this defensively in C++ within ConnectionManagerImpl.
If you blindly parse the first IP in X-Forwarded-For (XFF), a malicious payload like X-Forwarded-For: 127.0.0.1, 203.0.113.50 easily bypasses naive IP blocklists.
// Envoy's approach to determining the trusted client IP
// Source: envoy/source/common/http/conn_manager_utility.cc
void ConnectionManagerUtility::mutateRequestHeaders(
Http::RequestHeaderMap& headers, Network::Connection& connection,
const envoy::config::core::v3::HttpConnectionManager& config,
const LocalInfo::LocalInfo& local_info) {
// Determine the true remote address based on configured trusted hops
uint32_t xff_num_trusted_hops = config.xff_num_trusted_hops();
// Envoy securely iterates backwards through the XFF header list
// skipping exactly `xff_num_trusted_hops` to find the true client IP.
auto xff_address = utility::getLastAddressFromXFF(headers, xff_num_trusted_hops);
if (xff_address != nullptr) {
// Overwrite the remote address with the validated XFF IP
connection.connectionInfoSetter().setRemoteAddress(xff_address);
}
}
The Mathematical Invariant: Let $H = [IP_1, IP_2, …, IP_n]$ be the list of IPs in XFF. If your infrastructure has $K$ layers of trusted reverse proxies, the true client IP is always at index $n – K$. Any IP at index $i < n - K$ must be treated as hostile injected payload.
3. SPIFFE/SPIRE: Mathematical Identity Verification (Zero-Trust)
Relying on network topography (VPC isolation, IP whitelisting) is an anti-pattern. Modern architectures utilize SPIFFE (Secure Production Identity Framework for Everyone) to cryptographically attest identity. Instead of “Is this connection from the reverse proxy IP?”, the question is “Does this connection hold a valid X.509 SVID signed by our root CA?”
The probability of a forged identity under SPIFFE is constrained by the Discrete Logarithm Problem (for ECDSA) or integer factorization (RSA). For an attacker to forge an SVID, they must solve the ECDSA signature equation $s = k^{-1} (z + r d_A) pmod n$, which takes $O(sqrt{n})$ time using Pollard’s rho algorithm, computationally infeasible for 256-bit curves ($2^{128}$ operations).
4. eBPF: Microsecond-Level Boundary Profiling
To measure the true cost of traversing a proxy boundary, we discard userspace curl scripts and use eBPF (Extended Berkeley Packet Filter). By hooking into kernel TCP state transitions, we can trace the exact latency of the socket backlog and proxy memory allocation.
// eBPF kprobe tracing proxy accept() latency
#include <linux/bpf.h>
#include <linux/tcp.h>
BPF_HASH(start_time, u32, u64);
int kprobe__tcp_v4_conn_request(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
u32 pid = bpf_get_current_pid_tgid();
u64 ts = bpf_ktime_get_ns();
start_time.update(&pid, &ts);
return 0;
}
int kretprobe__tcp_v4_conn_request(struct pt_regs *ctx) {
u32 pid = bpf_get_current_pid_tgid();
u64 *tsp = start_time.lookup(&pid);
if (tsp != 0) {
u64 delta_us = (bpf_ktime_get_ns() - *tsp) / 1000;
bpf_trace_printk("Proxy SYN-ACK latency: %d us\n", delta_us);
start_time.delete(&pid);
}
return 0;
}
Running this BCC/eBPF script allows engineers to detect kernel-level SYN-flooding or socket lock contention before it manifests as Application Layer (L7) HTTP 504 errors.
5. Mathematical Modeling of Proxy Latency and Queuing
Let’s formalize the latency introduced by a proxy. Rather than a deterministic addition, it follows an $M/M/1$ or $M/D/1$ queuing model. The expected waiting time $W_q$ in the proxy’s event loop is given by Pollaczek-Khinchine formula:
$$ W_q = frac{lambda mathbb{E}[S^2]}{2(1 – rho)} $$
Where $lambda$ is the arrival rate, $rho = lambda mu^{-1}$ is the utilization factor, and $mathbb{E}[S^2]$ is the second moment of service time. A proxy TLS handshake involves RSA/ECDSA operations with high variance. As $rho to 1$, $W_q$ diverges to infinity. This proves mathematically why reverse proxies must shed load (circuit breaking) rather than queueing indefinitely when backend services degrade.
Engineering Trust-Boundary Checklist
- Cryptographic Identity over IP: Implement SPIFFE/mTLS between reverse proxies and upstream services. Never rely purely on network segments.
- eBPF Socket Acceleration: Deploy Cilium or
sockmapto bypass TCP/IP overhead for sidecar/proxy IPC. - X-Forwarded-For Sanitization: Explicitly configure
xff_num_trusted_hopsin Envoy orset_real_ip_fromin Nginx. Drop invalid packets at the edge. - Latency Distributions: Measure proxy latency via eBPF histograms, observing the 99.9th percentile ($P_{99.9}$).
References
Search questions
FAQ
Who is this article for?
This article is for readers who want an intermediate-level guide to Forward Proxy vs Reverse Proxy: Connection Paths, Trust Boundaries, and Latency. It takes about 12 min and focuses on Forward Proxy, Reverse Proxy, TLS, Python.
What should I read next?
The recommended next step is HTTP CONNECT and HTTPS Proxy Tunnels: TLS Boundaries and Handshake Latency, so the article connects into a longer learning route instead of ending as an isolated note.
Does this article include runnable code or companion resources?
Yes. Use the run notes, resource cards, and download links on the page to reproduce the example or inspect the companion files.
How does this article fit into the larger site?
It is connected to the article context block, learning routes, resources, and project timeline so readers can move from concept to implementation.
Article context
Network Fundamentals
A reproducible route through DNS, TCP, TLS, HTTP/3, proxy tunnels, load balancing, and shared caches with code and figures.
A reproducible guide to forward proxies, reverse proxies, tunnels, TLS boundaries, and latency segments.
Download share card Open share centerCompanion resources
Network Fundamentals / GUIDE
Network Fundamentals Lab README
Setup, no-privilege safety boundary, ten Python experiments, and three C examples.
Network Fundamentals / DATASET
Proxy path latency results CSV
Phase timing for direct access, forward-proxy tunneling, and reverse-proxy cache paths.
Network Fundamentals / ARCHIVE
Network fundamentals full lab bundle
Bundles Python/C source, fixed scenarios, ten result CSVs, and protocol/proxy figures.
Project timeline
Published posts
- DNS Resolution Explained: Build a TTL Cache and Packet Parser in Python A runnable DNS guide covering resolution paths, response headers, TTL cache latency, and deterministic Python/C experiments.
- CIDR, Longest Prefix Match, and MTU: Calculate IP Routing Step by Step Calculate CIDR ranges, longest-prefix route choice, and MTU/MSS payload segmentation with runnable Python and C examples.
- TCP Reliability and Congestion Window: A Runnable Sequence Number Experiment Track TCP sequence numbers, cumulative ACKs, loss, retransmission, and congestion-window changes with safe local experiments.
- HTTPS and TLS 1.3 Handshake: Keys, Certificates, and RTT in Practice Understand TLS 1.3 message flights, certificate authentication, ephemeral key agreement, and handshake latency with a safe teaching model.
- HTTP/2, HTTP/3, and CDN Caching: Read Page Speed from a Waterfall A deterministic browser-waterfall model for HTTP/2, HTTP/3, QUIC streams, and CDN cache hits or misses.
- Forward Proxy vs Reverse Proxy: Connection Paths, Trust Boundaries, and Latency A reproducible guide to forward proxies, reverse proxies, tunnels, TLS boundaries, and latency segments.
- HTTP CONNECT and HTTPS Proxy Tunnels: TLS Boundaries and Handshake Latency An RFC-based explanation of CONNECT tunnels, encrypted HTTPS payloads, and modeled first-request latency.
- SOCKS5 Proxy Explained: Protocol Bytes, DNS Resolution Boundaries, and Leakage Risk Decode safe SOCKS5 CONNECT bytes and compare local-DNS and proxy-side hostname resolution boundaries.
- Reverse Proxy Load Balancing: Queues, Health Checks, and a Reproducible Scheduler Compare round robin and load-aware queue selection while reasoning about health checks and retry boundaries.
- Proxy Cache Revalidation: Cache-Control, ETag, and Observable Correctness Use an RFC 9111 shared-cache model to calculate MISS, HIT, and 304 revalidation latency and correctness boundaries.
Published resources
- Network Fundamentals Lab README Setup, no-privilege safety boundary, ten Python experiments, and three C examples.
- Network fundamentals full lab bundle Bundles Python/C source, fixed scenarios, ten result CSVs, and protocol/proxy figures.
- DNS TTL results CSV HIT/MISS state, expiry, and latency for four fixed lookups.
- CIDR and MTU results CSV Longest-prefix route and 3600-byte payload segmentation results.
- TCP cwnd events CSV Per-round ACK, window, and deterministic retransmission events.
- TLS 1.3 flight results CSV Message direction, timing, and teaching shared value in a fixed RTT model.
- HTTP/CDN waterfall results CSV Phase timing for HTTP/2 and HTTP/3 in cold and warm cache models.
- Proxy path latency results CSV Phase timing for direct access, forward-proxy tunneling, and reverse-proxy cache paths.
- CONNECT/TLS timeline CSV Records CONNECT authority, tunnel establishment, and the encrypted HTTPS-request boundary.
- SOCKS5 DNS boundary CSV Stores ATYP, destination bytes, request length, and modeled local DNS counts.
- Proxy load-balancing queue CSV Compares backend selection and queue waiting for round robin and least queue.
- Proxy cache revalidation CSV Records MISS, HIT, 304 revalidation, object age, and response latency.
- Network request path visualizer Adjust TTL, prefixes, loss, handshake RTT, and cache paths in the browser.
- Network fundamentals topic share card A 1200x630 SVG card for the DNS, TLS, HTTP/3, proxy tunnel, and caching topic hub.
Next notes
- Add IPv6 and QUIC observation notes
- Review caching and protocol benefits with real-user metrics
