Now many webmasters have used CDN acceleration. First, it brings users the fastest browsing experience. Second, it protects the origin site. It was just discovered inadvertently that, when you open WordPress comments, the comment ip is basically the same. Through troubleshooting, it is all the cloud CDN node IP addresses. If you encounter malicious comments, you can't directly intercept the CDN IP. So how to display the comment's real IP after enabling cdn? Baidu got a piece of code, # Collection

Open the site and directory/wp-config.php file, and add code to the second line<? Below php

 /**Get IP using CDN*/ if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $list = explode(',',$_SERVER['HTTP_X_FORWARDED_FOR']); $_SERVER['REMOTE_ADDR'] = $list[0]; }

The code comes from the network

In this way, the comments on IP are normal.

End
If you think my article is useful to you, please feel free to appreciate it