An error with the docs of $host

Ruslan Ermilov ru at nginx.com
Fri Nov 30 07:08:28 UTC 2012


On Fri, Nov 30, 2012 at 11:18:15AM +0800, 姚伟斌 wrote:
> Hi,
> 
> In the docs of $host at
> http://nginx.org/en/docs/http/ngx_http_core_module.html#variables, it says:
> 
> $host
> “Host” request header field, or the server name matching a request if this
> field is not present
> 
> It's not right with the host header like: www.example.com:1234.  The $host
> variable always strips the port.

How's this instead?

%%%
Index: xml/en/docs/http/ngx_http_core_module.xml
===================================================================
--- xml/en/docs/http/ngx_http_core_module.xml	(revision 775)
+++ xml/en/docs/http/ngx_http_core_module.xml	(working copy)
@@ -2754,8 +2754,10 @@
 
 <tag-name id="var_host"><var>$host</var></tag-name>
 <tag-desc>
-<header>Host</header> request header field,
-or the server name matching a request if this field is not present
+in this order of precedence:
+host from the request line, or
+host from the <header>Host</header> request header field,
+or the server name matching a request
 </tag-desc>
 
 <tag-name id="var_hostname"><var>$hostname</var></tag-name>
%%%



More information about the nginx mailing list