@@ -50,19 +50,20 @@ The connect-middleware also supports retrieving the ip address under a custom at
50
50
51
51
It looks for specific headers in the request and falls back to some defaults if they do not exist.
52
52
53
- The following is the order we use to determine the user ip from the request.
53
+ The user ip is determined by the following order:
54
54
55
55
1 . ` X-Client-IP `
56
56
2 . ` X-Forwarded-For ` (Header may return multiple IP addresses in the format: "client IP, proxy 1 IP, proxy 2 IP", so we take the the first one.)
57
57
3 . ` CF-Connecting-IP ` (Cloudflare)
58
- 4 . ` True-Client-Ip ` (Akamai and Cloudflare)
59
- 5 . ` X-Real-IP ` (Nginx proxy/FastCGI)
60
- 6 . ` X-Cluster-Client-IP ` (Rackspace LB, Riverbed Stingray)
61
- 7 . ` X-Forwarded ` , ` Forwarded-For ` and ` Forwarded ` (Variations of #2 )
62
- 8 . ` req.connection.remoteAddress `
63
- 9 . ` req.socket.remoteAddress `
64
- 10 . ` req.connection.socket.remoteAddress `
65
- 11 . ` req.info.remoteAddress `
58
+ 4 . ` Fastly-Client-Ip ` (Fastly CDN and Firebase hosting header when forwared to a cloud function)
59
+ 5 . ` True-Client-Ip ` (Akamai and Cloudflare)
60
+ 6 . ` X-Real-IP ` (Nginx proxy/FastCGI)
61
+ 7 . ` X-Cluster-Client-IP ` (Rackspace LB, Riverbed Stingray)
62
+ 8 . ` X-Forwarded ` , ` Forwarded-For ` and ` Forwarded ` (Variations of #2 )
63
+ 9 . ` req.connection.remoteAddress `
64
+ 10 . ` req.socket.remoteAddress `
65
+ 11 . ` req.connection.socket.remoteAddress `
66
+ 12 . ` req.info.remoteAddress `
66
67
67
68
If an IP address cannot be found, it will return ` null ` .
68
69
@@ -96,7 +97,8 @@ To easily generate a new changelog, install [github-changelog-generator](https:/
96
97
* Thanks to [ @osherx ] ( https://github.com/osherx ) for adding the connect-middleware.
97
98
* Thanks to [ @raunc ] ( https://github.com/raunc ) for adding Squid proxy support.
98
99
* Thanks to [ @fluxsauce ] ( https://github.com/fluxsauce ) for adding ` CF-Connecting-IP ` , ` True-Client-IP ` , and ES6 support.
100
+ * Thanks to [ @vishalvijay ] ( https://github.com/vishalvijay ) for adding Fastly/Firebase hosting support.
99
101
100
102
## License
101
103
102
- The MIT License (MIT) - 2017
104
+ The MIT License (MIT) - 2018
0 commit comments