I recently had to setup Drupal behind a reverse proxy server. (If you don't know what a reverse proxy server is, check it out on Wikipedia) One thing people may not realize about this sort of setup is if you want your logs for your visitors to show up properly, you need to change a setting inside your settings.php file. Here's how.
What you'll need: Drupal, a reverse proxy server
How to do it:
- Open your settings.php file for editing
- Scroll down until you see the "Variable overrides" section
- roughly line 161
- Uncomment the " $conf = array ( " line
- roughly line 173
- Scroll down some more until you see " 'reverse_proxy' => TRUE" and uncomment that line
- roughly line 202
- Scroll down again to " 'reverse_proxy_addresses' => array('a.b.c.d', ...), " and uncomment that line
- roughly line 213
- Replace the "a.b.c.d" with the IP address of your reverse proxy server (you can have more than one if you want, just separate using commas)
- Scroll down one more time and uncomment the closing brackets for the " $conf " array
- should be just below the reverse proxy address array variable, line 214
- Save and you're good to go.
What this does is tell Drupal to accept and trust the X-Forwarded-For value sent by your reverse proxy servers. Those are the values of the IP addresses of your visitors. Now your Drupal access logs should reflect your actual visitors and not just list your reverse proxy server as your only visitor. If you want more information on this, check the comments in your settings.php file.
Thanks!
