Apache X-Forward-For settings for behinding reverse proxy

Add following settings into your httpd.conf or the configuration file in sites-available that linked to sites-enabled.
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" proxy 
SetEnvIf X-Forwarded-For "^.*\..*\..*\..*" forwarded 
CustomLog "logs/access_log" combined env=!forwarded
CustomLog "logs/access_log" proxy env=forwarded
After saving the settings, restart your httpd and you should see the real client IP in access log.

Comments

Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Conflict Serializability in database