HTTP 代理服务器会修改请求数据包吗? [英] Do HTTP proxy servers modify request packets?

查看:31
本文介绍了HTTP 代理服务器会修改请求数据包吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在通过代理服务器转发到服务器之前,是否在 HTTP 请求中添加或修改了任何请求标头?

Is any request header added or modified to the HTTP request before forwarding to the server by a proxy server?

如果是,是否对相同的数据包进行了更改,或者内容是否用于创建带有修改的新请求数据包?

If so, are the changes done to the same packets, or are the contents used to create new request packets with the modifications?

推荐答案

有几种不同类型的代理服务器.因为您提到了请求标头,所以我假设您说的是 HTTP 代理服务器,它转发 HTTP 请求,而不是数据包.

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.

注意:HTTPS 请求(TLS/SSL 通过 CONNECT),代理服务器 只是转发 TCP 数据包的内容(并且无法检查数据包,除非充当 中间人代理).

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).

当然这取决于代理软件及其配置,但 HTTP 代理预计遵循 W3C Web 内容转换代理指南,其中说明了很多内容,但最相关:

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:

  • 除了在 HEADGET 之间进行转换之外,代理不得更改请求方法.

  • Other than to convert between HEAD and GET proxies must not alter request methods.

如果请求包含 Cache-Control: no-transform 指令,则代理不得更改请求,除非符合 RFC 2616 HTTP 部分第 14.9 节中定义的透明 HTTP 行为.5 和第 13.5.2 节,并添加标题字段,如 4.1 中所述.6 个额外的 HTTP 标头字段.

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.

除了 RFC 2616 HTTP 代理要求的修改外,不应修改 User-AgentAccept 以外的标头字段的值Accept-CharsetAccept-EncodingAccept-Language头域,不得删除头域.

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.

代理应将请求发起者的 IP 地址添加到 X-Forwarded-For HTTP 标头字段.

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.

代理必须(根据 RFC 2616)包含 Via HTTP 标头字段.

Proxies must (in accordance with RFC 2616) include a Via HTTP header field.

总而言之,您通常可以期望这些 HTTP 标头由符合标准的代理更改/添加:

In summary, you can generally expect these HTTP headers to be changed/added by a standards-compliant proxy:

  • 用户代理
  • 接受
  • 接受字符集
  • 接受编码
  • 接受语言
  • X-Forwarded-For
  • 通过

这篇关于HTTP 代理服务器会修改请求数据包吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆