RSS

Posts in 2022

  • NGINX access_log log the real client IP from X-Forwarded-For/X-Real-IP instead of the proxy IP

    Last Update: in nginx

    Have a nginx server receive requests from proxy or behind CDN, how to get client user’s real IP instead of proxy/CDN servers IP in access log? This article provide two solutions based on log_format and nginx realip module.

    access_log log format The nginx access_log default use predefined combined format for log format, the log looks like: 91.92.94.95 - - [03/Jan/2022:07:21:59 -0300] "GET /foo HTTP/1.1" 200 13831 "https://duckduckgo.com/" …

    Read more