How to get client IP address in AEM
How to get the client ip address in a easy way through AEM either using dispatcher or any other method.
How to get the client ip address in a easy way through AEM either using dispatcher or any other method.
Hi @kbitra1998 ,
You need to add something in configuration like below.
APACHE CONFIGURATION FILE: /etc/httpd/conf.d/httpd.conf
<IfModule remoteip_module> RequestHeader edit X-Forwarded-For ([0-9]+(?:\.[0-9]+){3})(:[0-9]+)? $1 early # valid for ALB, ELB, AppGateway or Load Balancer + CloudFront RemoteIPHeader X-Forwarded-For # valid for ALB, ELB, AppGateway or Load Balancer + Akamai RemoteIPHeader True-Client-IP </IfModule>
The above change will make sure the user’s IP address is added to the request header. The name of the header is X-Forwarded-For.
Also, the header will have 2 IP addresses ( comma separated ). We have to make sure we read the first IP address from the CSV string.
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.