After enabling CDN, the website obtains the user's real IP: Cloudflare CDN real IP address (Nginx, Apache)

Recently, when Qiufu was maintaining a client's website, the client requested that access from foreign IPs be blocked. According to the logs, most of the attacking IPs came from abroad, and the target users were domestic, so only domestic IPs were allowed to access the website. Can block the vast majority of CC and DDoS attacks. After actual testing, it was found that the effect is still good, and the cost of attacking again has increased a lot.

Subscribe to ngx_http_realip_module