获取Nginx转发请求的Client IP
- Nginx配置转发
1 | proxy_set_header X-Real-IP $remote_addr; |
- Zuul获取Real IP
1 | val split = request.getHeader("X-Forwarded-For").split(",") |
获取非转发情况下的Client IP
REMOTE_ADDR - This contains the real IP address of the client. That is the most reliable value you can find from the user.
REMOTE_HOST - This will fetch the Host name from which the user is viewing the current page. But for this script to work, Hostname Lookups On inside httpd.conf must be configured.