代理请求流程

End User -> Proxy A -> Proxy B -> Server

From End User to Proxy A, Proxy A will set it own Host, and put end End User Host into X-Forwarded-Host before making a request to Proxy B. So when Proxy A makes a request, its header will look like:

X-Forwarded-Host: <End User Host>
Host: <Proxy A Host>

And then, Proxy B receives it, it will do the same, append Proxy A’s Host to X-Forwarded-Host

X-Forwarded-Host: <End User Host>,<Proxy A Host>
Host: <Proxy B Host>

Reference: http://hustoknow.blogspot.com/2011/02/x-forwarded-for-vs-httpxforwardedhost.html

Forwarded

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Forwarded

标识通过代理连接服务器的原始客户端的信息。

# Forwarded: by=<identifier>;for=<identifier>;host=<host>;proto=<http|https>

Forwarded: for=192.0.0.1;proto=http;by=203.0.113.43

X-Forwarded-XXX

旧版,但是依然被使用

X-Forwarded-For

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For

标识原始客户端连接到代理的地址

# X-Forwarded-For: <client>, <proxy1>, <proxy2>
X-Forwarded-For: 192.168.0.1,192.168.0.2

X-Forwarded-Prot

标识原始客户端连接到代理的端口

X-Forwarded-Proto

标识原始客户端连接到代理使用的协议
标识通过代理或者负载均衡连接到服务器的原始客户端的信息。被 Forwarded 代理,但是依然在使用。

X-Forwarded-Host

原始客户端连接到代理的请求里的 Host

Max-Forwardeds

限制请求可以通过代理转发的最大次数

Max-Forwardeds: 10

X-REAL-IP

标识原始客户端的真实网络地址。