Skip to content

Instantly share code, notes, and snippets.

@sakama
Last active December 12, 2015 04:18
Show Gist options
  • Save sakama/4712841 to your computer and use it in GitHub Desktop.
Save sakama/4712841 to your computer and use it in GitHub Desktop.
ロードバランサー配下にあるApacheでアクセス元IPをX-Forward-Forヘッダから取得してログに出力する方法 アクセス元IPが全てロードバランサーとなることを防ぐ
#変更前
LogFormat "%h %l %u %t \"%r\" %>s %b" common
#変更後
LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b" common
#変更前
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\"" combined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment