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 the comments on WordPress are basically those IP addresses. Through troubleshooting, they all took photos of 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