SetEnvIf ^X-Forwarded-For$ ^$ noxforward
SetEnvIf Remote_Addr "(.+)" xremote=$1
RequestHeader set X-Forwarded-For %{xremote}e env=noxforward

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v %{X-FORWARDED-FOR}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" commonvhost

Table of Contents

  1. Introduction
    1. LOG Formats and Settings

LOG Formats and Settings

#  LOG Formats and Settings {{{2
# ================================================================================
SetEnvIf ^X-Forwarded-For$ ^$ noxforward
SetEnvIf ^X-Forwarded-For$ "(.+)" xforwarded=$1

SetEnvIf ^X-Cluster-Client-Ip$ ^$ noxclusterip
SetEnvIf ^X-Cluster-Client-Ip$ "(.+)" xclusterip=$1

SetEnvIf Remote_Addr ^$ noxremote
SetEnvIf Remote_Addr "(10\.183\.253\.48)" noxremote
SetEnvIf Remote_Addr "(.+)" xremote=$1

#  If the environment variable specified in the env=... argument exists (or if the environment variable does not exist and env=!... is specified) then the action specified by the RequestHeader directive will take effect.
RequestHeader set X-ISC-IP %{xclusterip}e env=!noxclusterip
RequestHeader set X-ISC-IP %{xclusterip}e env=!noxremote
RequestHeader set X-ISC-IP %{xremote}e env=!xclusterip

LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v %{X-ISC-IP}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" commonvhost

Apache Logging for Remote Addresses using X-Forwarded-For - AskApache

Charles Torvalds
22 Jul 2016

Apache, F5, HTTPS, SetEnvIf, X-Forwarded-For

  • Site Map WireShark GNU Non-GNU Tor Project cURL TLDP - Documentation
  • Htaccess Files Hacking Htaccess Javascript Linux Optimization PHP Security Shell Scripting WordPress
  • Base64 Image Converter Raw HTTP Header Debugger Graphical ASCII Text Generator Mac Address Vendor Lookup Who Am I – Your IP Information Request Method Security Scanner .htpasswd file Generator Compress CSS DNS Tracer
Copyright © 2025 AskApache
  • Site Map
  • Htaccess Files
  • Hacking
  • Htaccess
  • Javascript
  • Linux
  • Optimization
  • PHP
  • Security
  • Shell Scripting
  • WordPress
  • Base64 Image Converter
  • Raw HTTP Header Debugger
  • Graphical ASCII Text Generator
  • Mac Address Vendor Lookup
  • Who Am I – Your IP Information
  • Request Method Security Scanner
  • .htpasswd file Generator
  • Compress CSS
  • DNS Tracer
Exit mobile version