[英]Do HTTP proxy servers modify request packets?
Is any request header added or modified to the HTTP request before forwarding to the server by a proxy server? 是否在代理服务器转发到服务器之前,是否向HTTP请求添加或修改了任何请求标头?
If so, are the changes done to the same packets, or are the contents used to create new request packets with the modifications? 如果是,是对相同的数据包进行了更改,还是用于创建带有修改的新请求数据包的内容?
There are a few different types of proxy servers. 有几种不同类型的代理服务器。 Because you've mentioned request headers, I'm going to assume that you're talking about HTTP proxy servers, which forward HTTP requests, not packets.
因为您已经提到了请求标头,我将假设您正在谈论HTTP代理服务器,它转发HTTP请求,而不是数据包。
NOTE: In the special case of HTTPS requests (TLS/SSL via CONNECT
), proxy servers will just forward the content of the TCP packets (and are unable to inspect the packets unless acting as a man-in-the-middle proxy). 注意:在HTTPS请求 (通过
CONNECT
TLS / SSL)的特殊情况下,代理服务器将仅转发TCP数据包的内容(并且除非充当中间人代理,否则无法检查数据包)。
Of course it depends on the proxy software and its configuration, but HTTP proxies are expected to follow the W3C Guidelines for Web Content Transformation Proxies , which states many things, but most relevantly: 当然,这取决于代理软件和它的配置,但HTTP代理预计遵循W3C 的Web内容转换代理指南 ,其中指出很多东西,但最贴切:
Other than to convert between HEAD
and GET
proxies must not alter request methods. 除了在
HEAD
和GET
代理之间进行转换之外,不得更改请求方法。
If the request contains a Cache-Control: no-transform
directive, proxies must not alter the request other than to comply with transparent HTTP behavior defined in RFC 2616 HTTP sections section 14.9.5 and section 13.5.2 and to add header fields as described in 4.1.6 Additional HTTP Header Fields . 如果请求包含
Cache-Control: no-transform
指令,代理不得更改请求,除了遵守RFC 2616 HTTP部分第14.9.5节和第13.5.2节中定义的透明HTTP行为,并添加标题字段,如上所述4.1.6其他HTTP标头字段 。
Other than the modifications required by RFC 2616 HTTP proxies should not modify the values of header fields other than the User-Agent
, Accept
, Accept-Charset
, Accept-Encoding
, and Accept-Language
header fields and must not delete header fields. 除了RFC 2616 HTTP代理所需的修改之外,不应修改除
User-Agent
, Accept
, Accept-Charset
, Accept-Encoding
和Accept-Language
头字段之外的头字段的值,并且不得删除头字段。
Proxies should add the IP address of the initiator of the request to the end of a comma separated list in an X-Forwarded-For
HTTP header field. 代理应将请求的发起者的IP地址添加到
X-Forwarded-For
HTTP头字段中逗号分隔列表的末尾。
Proxies must (in accordance with RFC 2616) include a Via
HTTP header field. 代理必须(根据RFC 2616)包含
Via
HTTP头字段。
In summary, you can generally expect these HTTP headers to be changed/added by a standards-compliant proxy: 总之,您通常可以期望这些HTTP标头由符合标准的代理更改/添加:
User-Agent
Accept
Accept-Charset
Accept-Encoding
Accept-Language
X-Forwarded-For
Via
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.