リバプロの下にいるapacheのログフォーマットの変更。
apacheの変更前のログフォーマット
LogFormat "%h %{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combine
変更後のログフォーマット
# X-Forwarded-For の値を信用して最初のIPをクライアントIPとして利用する
RemoteIPHeader X-Forwarded-For
RemoteIPTrustedProxy 127.0.0.1/8
RemoteIPTrustedProxy 10.0.0.0/8
RemoteIPTrustedProxy 172.16.0.0/12
RemoteIPTrustedProxy 192.168.0.0/16
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
RemoteIPTrustedProxy には0.0.0.0/0 を指定してはいけない。

コメント