HTTP Host request header指定了接收请求的服务器的主机名和端口号。
如果没有包含端口,则默认使用请求服务的端口(例如,HTTPS URL 默认为 443,HTTP URL 默认为 80)。
所有 HTTP/1.1 请求消息中都必须发送一个 Host 标头字段。如果 HTTP/1.1 请求消息中缺少标头字段或包含多个 Host 标头字段,可能会发送 400 状态码。
<table class="properties"> <tbody> <tr> <th scope="row">标头类型</th> <td>Request header</td> </tr> <tr> <th scope="row">Forbidden header name</th> <td>是</td> </tr> </tbody> </table>
语法
Host: <host>:<port>
指令
<host>- : 服务器的域名(用于虚拟主机)。
<port>- : 服务器监听的 TCP 端口号。
示例
Host: developer.mozilla.org
规范
浏览器兼容性
参见
- 400
- base
来源:MDN Web Docs / Mozilla 贡献者 · 作者与贡献记录 · CC BY-SA 2.5。离线整理了版式、链接和媒体显示。
