From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../web/http/headers/x-forwarded-host/index.html | 64 ++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 files/zh-cn/web/http/headers/x-forwarded-host/index.html (limited to 'files/zh-cn/web/http/headers/x-forwarded-host') diff --git a/files/zh-cn/web/http/headers/x-forwarded-host/index.html b/files/zh-cn/web/http/headers/x-forwarded-host/index.html new file mode 100644 index 0000000000..22e93c14ca --- /dev/null +++ b/files/zh-cn/web/http/headers/x-forwarded-host/index.html @@ -0,0 +1,64 @@ +--- +title: X-Forwarded-Host +slug: Web/HTTP/Headers/X-Forwarded-Host +tags: + - 代理 + - 请求首部 + - 负载均衡 + - 超文本传输协议 + - 转发 + - 首部 +translation_of: Web/HTTP/Headers/X-Forwarded-Host +--- +
{{HTTPSidebar}}
+ +

The X-Forwarded-Host (XFH) 是一个事实上的标准首部,用来确定客户端发起的请求中使用  {{HTTPHeader("Host")}}  指定的初始域名。

+ +

反向代理(如负载均衡服务器、CDN等)的域名或端口号可能会与处理请求的源头服务器有所不同,在这种情况下,X-Forwarded-Host 可以用来确定哪一个域名是最初被用来访问的。

+ +

这个消息首部会被用来进行调试和统计,以及生成基于位置的定制化内容,按照设计的目的,它会暴露一定的隐私和敏感信息,比如客户端的IP地址。所以在应用此消息首部的时候,需要将用户的隐私问题考虑在内。

+ +

HTTP 协议中的  {{HTTPHeader("Forwarded")}}  是这个消息首部的标准化版本。

+ + + + + + + + + + + + +
Header type{{Glossary("Request header")}}
{{Glossary("Forbidden header name")}}no
+ +

语法

+ +
X-Forwarded-Host: <host>
+
+ +

指令

+ +
+
<host>
+
被转发的服务器的域名。
+
+ +

示例

+ +
X-Forwarded-Host: id42.example-cdn.com
+
+ +

规范

+ +

不属于任何一份既有规范。这个消息首部的标准版本是 {{HTTPHeader("Forwarded")}}.

+ +

相关内容

+ + -- cgit v1.2.3-54-g00ecf