-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add req.host property documentation to 5.x API
- Loading branch information
1 parent
d13082d
commit e39992d
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<h3 id='req.host'>req.host</h3> | ||
|
||
Contains the host derived from the `Host` HTTP header. | ||
|
||
When the [`trust proxy` setting](api.html#app.settings.table) | ||
does not evaluate to `false`, this property will instead get the value | ||
from the `X-Forwarded-Host` header field. This header can be set by | ||
the client or by the proxy. | ||
|
||
If there is more than one `X-Forwarded-Host` header in the request, the | ||
value of the first header is used. This includes a single header with | ||
comma-separated values, in which the first value is used. | ||
|
||
```js | ||
// Host: "example.com:3000" | ||
console.dir(req.host) | ||
// => 'example.com:3000' | ||
|
||
// Host: "[::1]:3000" | ||
console.dir(req.host) | ||
// => '[::1]:3000' | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters