nugawiki

./categories/server

Apache X-Forwarded-For (mod_remoteip)

업데이트 2026-07-21 조회수

Apache 2.4.6 / mod_remoteip

모듈

LoadModule remoteip_module modules/mod_remoteip.so

httpd.conf

<IfModule remoteip_module>
    RemoteIPHeader X-Forwarded-For
    RemoteIPTrustedProxy 10.40.0.0/24
</IfModule>

신뢰 Proxy CIDR은 환경에 맞게 변경.

로그 포맷 (%h%a)

<IfModule log_config_module>
    LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%a %l %u %t \"%r\" %>s %b" common
    CustomLog "logs/access_log" combined
</IfModule>

%a = RemoteIP 반영 클라이언트 IP.

./comments