Apache 앞에 LB 등 Proxy 서비스를 해주는 어플리케이션이 있을 경우 클라이언트 IP를 확인하는 방법입니다.
X-Forwarded-For 헤더를 이용하여 사용자 IP를 구할 수 있으며, mod_remoteip 모듈이 필요합니다.
공식 가이드 : https://httpd.apache.org/docs/2.4/mod/mod_remoteip.html
mod_remoteip - Apache HTTP Server Version 2.4
Apache Module mod_remoteip Summary This module is used to treat the useragent which initiated the request as the originating useragent as identified by httpd for the purposes of authorization and logging, even where that useragent is behind a load balancer
httpd.apache.org
<IfModule remoteip_module>
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 172.16.0.0/16 ## 내부 IP
RemoteIPTrustedProxyList conf/TruestIP ##리스트
</IfModule>
`conf/TrustIP` 에 다음과 같은 형식으로 IP 추가 및 관리 하시면 되십니다.
8.8.8.8/32
1.1.1.1/32
'웹 > Apache' 카테고리의 다른 글
Apache#13 - 브라우저(클라이언트) 캐시 설정 (0) | 2021.10.22 |
---|---|
Apache#12 - Cloudflare Client IP 로그 찍기 (0) | 2021.10.22 |
Apache#10 - gzip 설정 (0) | 2021.10.20 |
Apache#9 - 서버 정보 숨기기 (0) | 2018.05.20 |
Apache#8 - SSLPassPhrasedialog 오류 (0) | 2016.07.22 |