/**
* Reverse proxy configuration:
* Reverse proxy servers are often used to enhance the performance of websites with large loads and provide additional site cache and security benefits.
* After Drupal is deployed with a reverse proxy server, Drupal's logs, Statistics, and access control systems all need to obtain real user IP addresses.
* Generally, the reverse proxy server adds the X-Forwarded-For header to the request to pass the customer IP address.
* However, the HTTP Header is very fragile for client fraud. Some clients can directly generate this Header information.
* Therefore, Drupal needs to set all proxy server addresses in $ conf ['reverse _ proxy_address.
*
* Activating this setting allows Drupal to obtain the user's IP address from the X-Forwarded-For header.
* The Header name can also be changed to another name through $ conf ['reverse _ proxy_header.
* If you are not sure whether a reverse proxy is used, you do not need to set it if you do not know the meaning of this option, or if the site is hosted on a shared host.
*
* When this configuration is enabled, the address of each reverse proxy server must be saved in $ conf ['reverse _ proxy_addresses.
* If you cannot obtain a complete list of reverse proxy servers (such as CDN) in your environment ). You can directly set $ _ SERVER ['remote _ ADDR '] in settings. php.
* This means that the IP address may be forged.
*/
The code is as follows: |
Copy code |
$ Conf ['reverse _ proxy'] = TRUE; |
/**
* If $ conf ['reverse _ proxy'] is set to TRUE, all proxy servers must be listed here.
*/
The code is as follows: |
Copy code |
$ Conf ['reverse _ proxy_addresses '] = array ('A. B. c. D ',...); |
If a friend has encountered such a problem like me, set it up first to see if the problem can be solved.