An IP address, subnet, or an array of IP addresses and subnets to trust as being a reverse proxy. The following list shows the pre-configured subnet names:
You can set IP addresses in any of the following ways:
When specified, the IP addresses or the subnets are excluded from the address determination process, and the untrusted IP address nearest to the application server is determined as the client’s IP address. This works by checking if
Use the address that is at most
Custom trust implementation.
req.hostname is derived from the value set in the X-Forwarded-Host header, which can be set by the client or by the proxy.
req.ips values are populated based on the socket address and X-Forwarded-For header, starting at the first untrusted address.
Express 5.0 is still in the beta release stage, but here is a preview of the changes that will be in the release and how to migrate your Express 4 app to Express 5.
$ npm install "express@>=5.0.0-beta.1" --save